抽象類自動{
私人串串品牌;//品牌
私有字符串useOilType//使用的油的類型
私有雙倍當前油量//當前油量
公void加油(雙倍油量){//加油。
this . currentqilquantity+= oil quantity;
}
公共抽象void drive();//驅動
//為成員屬性添加set/get方法。
}
//汽車
汽車級延伸汽車{
私彩色彩;//顏色
私人雙倍價格;//價格
公void加油(雙倍油量){//加油。
this . currentqilquantity+= oil quantity;
}
Public void drive(){// Drive。
this . currentqilquantity-= 1;
}
//為成員屬性添加set/get方法。
//默認無參數構造函數
}
//總線
汽車級延伸汽車{
私人整數席位;//座位數量
私房雙人carPrice//價格
公void加油(雙倍油量){//加油。
this . currentqilquantity+= oil quantity;
}
Public void drive(){// Drive。
this . currentqilquantity-= 1;
}
公共void carry(){//乘客
System.out.println("乘客");
}
//為成員屬性添加set/get方法。
//默認無參數構造函數
}
公共類自動演示{
公共靜態void main(String [] args){
車c =新車();
總線b =新總線();
c .阿多伊(50);
c . driver();
b . driver();
b . carry();
}
}