class Person {
private int id;
public static int total = 0;
public Person() {
total++;
id = total;
}
}
class OtherClass {
public static void main(String args[]) {
Person.total = 100;
System.out.println(Person.total);
Person c = new Person();
System.out.println(Person.total);
}
}
结果为什么先是100 后是101呢~~看不懂
------解决方案--------------------
上面说得很清楚了,学习。