class Person
{
String name;
Person(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
}
class Student extends Person
{
Student(String name)
{
super(name);
}
}
class Demo
{
public static void main(String[] agrs)
{
System.out.println(new Student("张三").getName());
}
}
我的问题是:
执行super(name)的时候,会执行this.name=name;那么"张三"这时是赋值给Student对象了还是赋值给Person对象了.可能我说错了,如果能讲解下"张三"是怎么传递的,不甚感激. |
|