继承中的this和super的区别
class Person{
int age;
int height;
void eat(){}
void sleep(){}
Person(){} //父类构造方法
}
class Student extends Person{
int score;
void study(){}
Student(){}//子类构造方法
}

注意:this不能引用父类的构造函数
class Person{
int age;
int height;
void eat(){}
void sleep(){}
Person(){} //父类构造方法
}
class Student extends Person{
int score;
void study(){}
Student(){}//子类构造方法
}

注意:this不能引用父类的构造函数
暂无评论。
评论功能维护中,当前仅展示历史评论。