接口与继承

interface student{
    public void study();
}

interface studentworker extends student{
    public void earn();
    
}
public class Goodstudent implements studentworker {
    String name;
    public Goodstudent(String name){
        this.name=name;
    }
    void job(){
        System.out.println(name+"是好男人!!!");
    }
    public static void main(String[] args) {
        Goodstudent a=new Goodstudent("刘煜炀");
        a.study();
        a.earn();
        a.job();
    }
    public void study() {
        System.out.println(name+"会学习!!");        
    }
    public void earn() {
        System.out.println(name+"会赚钱!!");    
        
    }

}
原文地址:https://www.cnblogs.com/LYY1084702511/p/10872614.html