/*由static制作累加器*/
class Static1{
private static int counter1 = 0;
public Static1(){
counter1++;
System.out.println(counter1);
}
}
public class StaticDemo1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i<10;i++){
new Static1();
}
}
}
class Static1{
private static int counter1 = 0;
public Static1(){
counter1++;
System.out.println(counter1);
}
}
public class StaticDemo1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i<10;i++){
new Static1();
}
}
}