0

Excuse me,I am in trouble of an example of "package" in java.Please help me 🙇🙇

package id; import java.util.Random; public class RandId{ private static int counter; private int id; static { Random rand = new Random(); counter = rand.nextInt(10)*100; } public RandId(){ id=++counter; } public int getId(){ return id;} } import id.RandId; public class RandIdTester { public static void main(String[]args){ RandId a=new RandId(); RandId b=new RandId(); RandId c=new RandId(); System.out.println("The sign number of a " +a.getId()); System.out.println("The sign number of b " +b.getId()); System.out.println("The sign number of c " +c.getId()); } }

25th Jul 2018, 12:54 AM
Hunt
Hunt - avatar
2 Answers
+ 1
Thanks very much!
25th Jul 2018, 2:29 AM
Hunt
Hunt - avatar
0
Not sure what you are trying to do, but https://code.sololearn.com/c9NQs3wA0io9/?ref=app
25th Jul 2018, 1:47 AM
Andre Daniel
Andre Daniel - avatar