是不是做错了 感觉不对呢 大佬指点一下
是不是做错了 感觉不对呢 大佬指点一下
是不是做错了 感觉不对呢 大佬指点一下
2019-07-09
public class HelloWorld { public int people; public String way; public void Abc(){ System.out.println("交通工具为:"+way+"\n乘车人数:"+people ); } public class bus extends HelloWorld{ public bus(int people,String way){ this.people=people; this.way=way; this.Abc(); } }public class run extends HelloWorld{ public run(int people,String way){ this.people=people; this.way=way; this.Abc(); } } public static void main(String[] args) { HelloWorld num=new HelloWorld(); bus nums=num.new bus(40,"公交"); run numss=nums.new run(4,"跑步"); }}
public class HelloWorld {
public int people;
public String way;
public void Abc(){
System.out.println("交通工具为:"+way+"\n乘车人数:"+people );
}
public class bus extends HelloWorld{
public bus(int people,String way){
this.people=people;
this.way=way;
this.Abc();
}
}
public class run extends HelloWorld{
public run(int people,String way){
this.people=people;
this.way=way;
this.Abc();
}
}
public static void main(String[] args) {
HelloWorld num=new HelloWorld();
bus nums=num.new bus(40,"公交");
run numss=nums.new run(4,"跑步");
}
}
举报