Java内存
[code=java]class Person
{
private String name;
private int age;
private static String country = "cn";
Person(String name,int age)
{
this.name = name;
this.age = age;
}
{
System.out.println(name+".."+age);
}
public void setName(String name)
{
this.name = name;
}
public void speak()
{
System.out.println(this.name+"..."+this.age);
}
public static void showCountry()
{
System.out.println("country="+country);
}
}
class PersonDemo
{
public static void main(String[] args)
{
Person p = new Person();
}
}
[/code]
public static void showCountry是存在在方法区的,类加载的时候就存在了,
public void speak存在于方法区内,问下他是什么进方法区的啊,还有程序源代码放在哪个内存