1.

How Will You Print 10 Random Numbers Using Foreach Of Java 8?

Answer»

The following code SEGMENT shows how to print 10 RANDOM numbers using FOREACH.

Random random = new Random();
random.ints().LIMIT(10).forEach(System.out::println);

The following code segment shows how to print 10 random numbers using forEach.

Random random = new Random();
random.ints().limit(10).forEach(System.out::println);



Discussion

No Comment Found