Create ArrayList object wid integer type
ArrayList<Integer> al = ArrayList<Integer>();
Then you have create for loop how many number you have add into list.
and add() method you have add number into Integer list.
for(int i=1;i<9;i++)
al.add(i);
Then Collection Class is use. it public class it's work collect all data and using shuffle() method you randomly generate your number.
so you must
import java.util.Collections;
Collection.shuffle(al);
System.out.println(al);
**********************************************************
Ok.
Comments
Post a Comment