/*第一问:
class ExtendsTest
{
public static void main(String[] args)
{
//new GoodStudent();
new Student();
}
}
class Person
{
Person()
{System.out.println("Person");}
}
class Student extends Person
{
Student()
{System.out.println("Student");}
}
class GoodStudent extends Student
{
GoodStudent()
{System.out.println("GoodStudent");}
}
*/
//第二问
class ExtendsTest
{
public static void main(String[] args)
{
//new GoodStudent();
new Student();
}
}
class Person
{
Person()
{System.out.println("Person");}
}
class Student extends Person
{
Student()
{
super();
System.out.println("Student");
}
}
//第二问修复下
class ExtendsTest
{
public static void main(String[] args)
{
//new GoodStudent();
new GoodStudent();
}
}
class Person
{
Person()
{System.out.println("Person");}
}
class Student
{
ExtendsTest e = new ExtendsTest();
Student()
//{System.out.println("Student");}
}
class GoodStudent extends Student
{
GoodStudent()
{System.out.println("GoodStudent");}
}