作业的代码有吗?
???//
???//
2019-12-08
package com.imooc.two;
public class Vehicle {
int Num;
String Way;
public void showWay(String Way){
}
public void shoeNum(int Num){
}
}
package com.imooc.two;
public class Plane extends Vehicle {
@Override
public void showWay(String Way) {
// TODO Auto-generated method stub
super.showWay(Way);
System.out.println("载客方式:"+Way);
}
@Override
public void shoeNum(int Num) {
// TODO Auto-generated method stub
super.shoeNum(Num);
System.out.println("运输人数为:"+Num);
}
}
package com.imooc.two;
public class VehicleInitail {
public static void main(String[] args) {
// TODO Auto-generated method stub
Vehicle plane=new Plane();
Vehicle boat=new Plane();
Vehicle bus=new Plane();
plane.showWay("飞机");
plane.shoeNum(50);
plane.showWay("轮船");
plane.shoeNum(200);
plane.showWay("公交车");
plane.shoeNum(80);
}
}
这是别人写的,我拿来借鉴,刚好你需要
举报