为了账号安全,请及时绑定邮箱和手机立即绑定

thread 中super关键字

thread 中super关键字

繁星点点滴滴 2019-03-21 18:19:03
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()啊
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 417 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号