Java 接口 抽象类 抽象方法

abstract class elehousekeeping { //抽象家用电器类
abstract void opermode(); //抽象方法
}

class TV extends elehousekeeping { //电视机
public void opermode() {
System.out.println("13:12 TV is working.");
}

}

class aircondition extends elehousekeeping { //空调
public void opermode() {
System.out.println("15:23 aircondition is working.");
}

}
class microven extends elehousekeeping { //微波炉
public void opermode() {
System.out.println("19:57 microven is working.");
}

}
public class Main3 {
public static void main(String[] args) {

TV T=new TV();
aircondition a =new aircondition();
microven m=new microven();
T.opermode();
a.opermode();
m.opermode();
}


}

posted on 2019-05-21 19:32  AIERSTOM  阅读(757)  评论(0编辑  收藏  举报

导航