ArrayList stored random number

Package com.fgy.demo; 

Import of java.util.ArrayList;
 Import java.util.Random; 

/ ** 
 * achieve the ArrayList stored random number 
 * / 
public  class demo05 {
     public  static  void main (String [] args) {
         // Pan only type is a reference type, the type can not be primitive, if the value is a basic type requires its wrapper class 
        List = the ArrayList <Integer> new new the ArrayList <> (); 
        the Random RA = new new the Random ();
         int NUM;
         for ( int 0 = I; I <10; I ++ ) { 
            NUM = ra.nextInt (20 is );
            list.add(num);
        }

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}

Guess you like

Origin www.cnblogs.com/roadlandscape/p/12061164.html