首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2011-12-07 
一个小程序,帮我讲讲吧~~~classPerson{privateintidpublicstaticinttotal0publicPerson(){total++idt

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

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

热点排行