标题: super小问题 [打印本页] 作者: xieguanxiong 时间: 2012-3-2 12:24 标题: super小问题 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);
}
}