摘要:
为什么子类的构造方法在运行之前,必须调用父类的构造方法?能不能反过来?为什么不能反过来? 构造方法的主要作用为在创建类对象时,对其实例化,对其中的数据进行初始化,如果子类的构造方法在运行之前,不调用父类的构造方法,则子类继承自父类的成员无法进行初始化,不能反过来,因为父类没有继承子类成员,没有子类成 阅读全文
posted @ 2022-10-10 17:56
ashuai~
阅读(100)
评论(0)
推荐(0)
摘要:
package test2; class Grandparent { public Grandparent() { System.out.println("GrandParent Created."); } public Grandparent(String string) { System.out 阅读全文
posted @ 2022-10-10 17:46
ashuai~
阅读(39)
评论(0)
推荐(0)

浙公网安备 33010602011771号