public class Mother extends Thread{String name;public Mother(String name) {this.name = name;}@Overridepublic void run() {System.out.println("mother");}}public class Son extends Mother{String name;public Son(String name) {super(name);this.name = name;}@Overridepublic void run() {System.out.println(name);}public void startup(){super.start();}}public class Launch {public static void main(String[] args) {Mother mother = new Mother("mother");Son son = new Son("son");son.startup();}}为什么打出了son???我的startup()方法里调的是super.startup()啊
添加回答
举报
0/150
提交
取消