读书人

一个小程序帮小弟我讲讲吧~

发布时间: 2011-12-07 22:35:48 作者: rapoo

一个小程序,帮我讲讲吧~~~
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呢~~看不懂

[解决办法]
上面说得很清楚了,学习。

读书人网 >J2SE开发

热点推荐