Java 8 Program to Print ten random numbers using forEach
Tags :
Author :
Updated :
👁 1370
Java 8 Program to Print ten random numbers using forEach |
Below is the program to generate 10 random number using forEach.
Here we are using Random class to generate Random number.
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random random = new Random();
random.ints().limit(10).forEach(System.out::println);
}
}
-1268703499
1402039482
-447617610
1637994480
323203484
684637852
478114337
-138286191
-1243111432
733650229