class Person{
private String name;
private int age;
static String country = "CN";
Person(int age){
this.age = age;
}
Person(String name,int age){
this(age);
this.name = name;
//this.age = age;
}
public boolean compareAge(Person p){
return this.age == p.age;
}
public void show(){
System.out.println(name+":"+country);
}
}
public class PersonDemo{
public static void main(String[] args){
Person p1 = new Person(23);
Person p2 = new Person(34);
System.out.println(p1.compareAge(p2));
p1.show();
}
}
在这段程序中country这个静态成员变量的生命周期在什么时候结束?
|