in Education by

How will you print 10 random numbers in a sorted order in Java 8?

Please log in or register to answer this question.

1 Answer

0 votes
by

How will you print 10 random numbers in a sorted order in Java 8?

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);

Related questions

0 votes
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
asked Feb 12, 2021 in Education by JackTerrance
0 votes
asked Nov 17, 2021 in Education by JackTerrance
...