作业是这样吗
package com.imooc;
public class vehicle {
String vehicles;
String way;
int number;
public vehicle(String vehicles,String way,int number) {
this.vehicles=vehicles;
this.way=way;
this.number=number;
System.out.println(vehicles+"可以在"+way+"运输"+number+"人");
}
}
package com.imooc;
public class bus extends vehicle {
public bus(String vehicles, String way, int number) {
super(vehicles, way, number);
// TODO Auto-generated constructor stub
}
}
package com.imooc;
public class boat extends vehicle {
public boat(String vehicles, String way, int number) {
super(vehicles, way, number);
// TODO Auto-generated constructor stub
}
}
package com.imooc;
public class Plane extends vehicle {
public Plane(String vehicles, String way, int number) {
super(vehicles, way, number);
// TODO Auto-generated constructor stub
}
}
package com.imooc;
public class fangfa {
public static void main(String[] args) {
vehicle i=new bus("汽车", "陆地", 40);
vehicle p=new boat("轮船", "海洋", 300);
vehicle l=new Plane("飞机", "空中", 100);
}
}
是这样吗