本帖最后由 王涛 于 2012-2-24 10:54 编辑
看了视频,这点还是不太明白,是怎样调用的,在内存中的顺序是?
class Person
{
private String name;
private int age;
private static String country = "cn";
Person (String name,int age)
{
this.name = name;
this.age = 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("zhangsan",20);
p.setName("list");
}
}
想知道是哪个先执行的,在内存中的顺序?谢谢
哦,看糊涂了,,忘写了,呵呵 |
|