接口与继承
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+"會學(xué)習(xí)!!"); }public void earn() {System.out.println(name+"會賺錢!!"); }}
?
轉(zhuǎn)載于:https://www.cnblogs.com/LYY1084702511/p/10872614.html
總結(jié)
- 上一篇: 不定宽高的div水平、垂直居中问题
- 下一篇: mySql中使用命令行建表基本操作