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()); } }
2 Answers
+ 1
Thanks very much!
0
Not sure what you are trying to do, but
https://code.sololearn.com/c9NQs3wA0io9/?ref=app