class DemoSuper
{
public static void main(String[] args)
{
Student stu=new Student();
stu.show();
Student stu1=new Student("小小");
}
}
class Person
{
private int age=10;
private String name="pa";
public Person(String name)
{
this.name=name;
System.out.println(this.name);
}
public void show()
{
System.out.println(age);
}
}
class Student extends Person
{ int age=20;
public Student()
{
System.out.println("小黑");
}
public Student(String name)
{
super(name);
}
public void show()
{
super.show();
int age=30;
System.out.println(age);
System.out.println(this.age);
}
} |