class Person
{
String name;
int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public void show(int a)
{
System.out.println(a);
}
}
class Student extends Person
{
String name;
int age;
public Student(String name, int age)
{
super(name, age);//问题1:为什么这不能写成super.Person(name,age);
}
public void show(int a)
{
super.show(a);//问题2:为什么这不能写成super(a);
}
}
class PersonTest
{
public static void main(String[] df)
{
Student s = new Student("zhansan",12);
s.show(1);
}
}
|