这段代码还有哪些地方有待改进
package jicheng;
public class jiaotong {
String name;
int num;
String way;
public void showDate(){
System.out.println(name+"在"+way+"上能载客"+num+"人");
}
}
父类
package jicheng;
public class car extends jiaotong {
public car(String newName,String newWay,int newNum){
super.name=newName;
super.way=newWay;
super.num=newNum;
}
}
汽车子类
package jicheng;
public class plane extends jiaotong {
public plane(String newName,String newWay,int newNum){
super.name=newName;
super.way=newWay;
super.num=newNum;
}
}
飞机子类
package jicheng;
public class ship extends jiaotong {
public ship(String newName,String newWay,int newNum){
super.name=newName;
super.way=newWay;
super.num=newNum;
}
}
轮船子类
package jicheng;
public class initial {
public static void main(String[] args) {
// TODO Auto-generated method stub
jiaotong car=new car("汽车","陆地",4);
jiaotong plane=new plane("飞机","空中",30);
jiaotong ship=new ship("轮船","海上",50);
car.showDate();
plane.showDate();
ship.showDate();
}
}
测试类