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
问题:
1、程序1中当运行完System.out.println(Person.country);语句后,变量country还在内存中吗?
2、程序2中,变量country进入过内存中吗?
|