父类,子类 多态
package immoc;
public class Transtration {
public static void main(String[] args){
double client;
double style;
double velocity;
Transtration obj1=new car();
Transtration obj2=new steamship();
Transtration obj3=new plan();
obj1.ship();
}
}
class car extends Transtration{
public void stration(double client){
client=30.0;
System.out.println("汽车在陆地上"+client);}
}
class steamship extends Transtration{
public void ship(double client ){
client=40.0;
System.out.println("轮般在海上运输"+client);
}
}
class plan extends Transtration{
public void air(double client){
client=50.0;
System.out.println("飞机在天空"+client);
}
}
父类创建对象 和引用那里不太会,,,,