作者
interface car{
int MAX_LOADWare=
}
//出租車最多能載
interface taxs{
int MAX_LOADMan =
}
//一般的汽車最高時速能達到
class fathercar{
int intspeed =
int drivespeed()
{
return intspeed;
}
}
///如果想要公共汽車有 小汽車的功能
//首先公共汽車(bus)繼承一般汽車
class bus extends fathercar implements car
private int intware; //定義
private int intman;
public int loadware()
{
intware=MAX_LOADWare;
return intware;
}
public int loadman()
{
intman =MAX_LOADMan;
return intman;
}
}
public class eat{
public static void main(String[] args){
bus nbbus= new bus();
//打印公共汽車的功能
System
System
System
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25957.html