class Counter
{
int num;
Counter(){
num++;
}
}
class CounterTest
{
public static void main(String[] args){
Counter c1=new Counter();
System.out.println(c1.num);输出 1;
Counter c2=new Counter();
System.out.println(c1.num);输出 1;
System.out.println(c2.num);输出 1;
}
} 给大家分享看看 |
|