interface 多继承

来源:互联网 发布:ubuntu core可以做什么 编辑:程序博客网 时间:2024/06/05 03:23

Mather 接口:

interface Mother{abstract void run();}

Father接口:

interface Father{abstract void eat();}

Child 接口:

interface Child extends Mother,Father{void sleep();}


此Child 接口里面exdends 后面有两个接口,代表了接口的多继承!!!!


测试类:

public class Test implements Child{public void run(){}public void eat(){}public void sleep(){}}
于是测试类里面重写这三个方法才能编译通过。

原创粉丝点击