in Education by

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

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
    How will you print 10 random numbers in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print 10 random numbers using forEach of java 8 ?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print unique squares of numbers in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print count of empty strings in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you get the sum of all numbers present in a list using Java 8 in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    Write a program to store 10 names in an array. Arrange these in alphabetical orderby sorting. Print the sorted list. ... , LUCY, etc. Select the correct answer from above options...
asked Dec 12, 2021 in Education by JackTerrance
0 votes
    What is the purpose of sorted method of stream in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the best method to store row data in a sorted order ? (1)use a clustering key (2)minimize the number of partions. (3)partition (4)use a primary key...
asked May 6, 2021 in Technology by JackTerrance
0 votes
    The digits 1,2,3,4,5,6,7,8 and 9 are written in random order to form a nine digit number. The probability that this ... 2 9 2 D. 7 9 7 Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
0 votes
    Calculate the magnetic energy when the magnetic flux density is given by 32 units(in 10^8 ... proposed by,electromagnetic theory engineering physics,electromagnetic theory nptel...
asked Nov 10, 2021 in Education by JackTerrance
0 votes
0 votes
    The numbers 1,2,3,.., n are arranged in a random order. The probability that the digits 1,2,3,..,k(n>k) appears ... n-k .nCk D. k! n! Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
...