1.

How Will You Print 10 Random Numbers In A Sorted Order In Java 8?

Answer»

The following code segment SHOWS how to PRINT 10 random numbers in a SORTED order.

Random random = NEW Random();
random.ints().limit(10).sorted().forEach(System.out::PRINTLN);

The following code segment shows how to print 10 random numbers in a sorted order.

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



Discussion

No Comment Found