标题: 关于全局变量的小疑问 [打印本页] 作者: 梁志冰 时间: 2012-9-20 21:20 标题: 关于全局变量的小疑问 class FinalDemo
{
public static void main(String[] args)
{
System.out.println(Person.country);
System.out.println("over");
}
}
class Person
{
public static final String country="cn";
private String name;
private int age;
Person(String name,int age){
this.name=name;
this.age=age;
}
}
程序1
class FinalDemo
{
public static void main(String[] args)
{
System.out.println("over");
}
}
class Person
{
public static final String country="cn";
private String name;
private int age;
Person(String name,int age){
this.name=name;
this.age=age;
}
}
程序2