class Static_Use {
public static void main(String[] args) {
show(new User());
User a=new User();
User b=new User();
show(a);
show(b);
}
public static void show(User s ){
System.out.println(s.getNumber());//打印结果为2,4,4----,为什么不会打印出2,3,4?
}
}
class User {
private static int number=1;
public User (){
number++;
}
public int getNumber(){
return number;
}
}
|
|