码迷,mamicode.com
首页 > 其他好文 > 详细

类实现多个接口的例子

时间:2016-04-10 14:18:19      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

 

类实现多个接口

技术分享
package java51;

public interface Useleg {
    void run();
    void walk();
}

package java51;

public interface Usemouth {
    void speak();
    void eat();
}

package java51;

public interface Useear {
    void hearMusic();
}

package java51;

public interface Useeye {
    void seeFilm();
}

package java51;

public class Person implements Useleg, Usemouth, Useear, Useeye{
    String name;
    int age;
    String adddress;
    String ID;
    public void run(){
        System.out.println("I am running.");
    }
    public void walk(){
        System.out.println("I am walking.");
    }
    public void speak(){
        System.out.println("I am speaking.");
    }
    public void eat(){
        System.out.println("I am eating.");
    }
    public void hearMusic(){
        System.out.println("I am leistening to music.");
    }
    public void seeFilm(){
        System.out.println("I am seeing a film.");
    }
}

package java51;

public class Test {

   
    public static void main(String[] args) {
        // TODO code application logic here
        Person p = new Person();
        p.seeFilm();
    }
}
View Code

 

类实现多个接口的例子

标签:

原文地址:http://www.cnblogs.com/scown/p/5373873.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!