in Education by
How will you print 10 random numbers using forEach of java 8 ?

1 Answer

0 votes
by

How will you print 10 random numbers using forEach of java 8 in Java8?

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

Related questions

0 votes
    How will you print 10 random numbers in a sorted order in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
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 unique squares of numbers 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
    How will you print count of empty strings in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of forEach method of stream in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you get the highest number present in a list using Java 8...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you sort a list of string using Java 8 lambda expression?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    WAP in java to input 3 numbers from user and print the largest no. among them using nested if. Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    I am working on spark project using Scala. I need to print each element of a list named 'c' ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    In a certain city, 5% of all the persons in town have unlisted phone numbers. If you select 100 names at ... directory, how many people selected will have unlisted phone numbers?...
asked Feb 12, 2021 in Education by JackTerrance
0 votes
    How will you set the starting value in generating random numbers?...
asked Nov 25, 2020 in Technology by JackTerrance
0 votes
0 votes
    A box contains 8 red marbles 6 green marbles and 10 pink marbles. One marble in drawn at random from the box. ... either red or green? Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
...