abstract class Demo{ abstract void method1(); abstract void method2(); … } |
interface Demo{ void method1(); void method2(); … } |
abstract class Door{ abstract void open(); abstract void close(); } |
interface Door{ void open(); void close(); } |
abstract class Door{ abstract void open(); abstract void close(); abstract void alarm(); } |
interface Door{ void open(); void close(); void alarm(); } |
class AlarmDoor extends Door{ void open(){…} void close(){…} void alarm(){…} } |
class AlarmDoor implements Door{ void open(){…} void close(){…} void alarm(){…} } |
abstract class Door{ abstract void open(); abstract void close(); } interface Alarm{ void alarm(); } class Alarm Door extends Door implements Alarm{ void open(){…} void close(){…} void alarm(){…} } |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |