Advertisement
CR7CR7

rndGenerator

Dec 3rd, 2022
530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2. class HelloWorld {
  3.     public static void main(String[] args) {
  4.         Random rnd =new Random();
  5.         int randomNum =rnd.nextInt(42);
  6.          int randomNum2 =rnd.nextInt(42);
  7.           int randomNum3 =rnd.nextInt(42);
  8.            int randomNum4 =rnd.nextInt(42);
  9.             int randomNum5 =rnd.nextInt(42);
  10.             int randomNum6 =rnd.nextInt(42);
  11.             int [] arr={randomNum,randomNum2,randomNum3,randomNum4,randomNum5,randomNum6};
  12.             for(int index=0;index<arr.length;index++){
  13.              System.out.println(arr[index]);
  14.             }
  15.             System.out.println("**********************");
  16.             for(int item:arr){
  17.                 System.out.println(item);
  18.                
  19.             }
  20.        
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement