java期末考试编程题.docVIP

  • 110
  • 0
  • 约4.91千字
  • 约 17页
  • 2020-09-14 发布于山东
  • 举报
完成生物、动物、人三个接口的定义。其中生物接口定义呼吸抽象方法,动物接口除具备生物接口特征之外 还定义了吃饭和睡觉两个抽象方法。人接口除具备动物接口特征之外,还定义了思维和学习两个抽象方法,定义一个学生类,有一个名字属性,要求实现上述人接口。不会做,哪位老师指点 public class TestInterface { public static void main(String[] args) { students s = new students(); s.breathe(); s.eat(); s.sleep(); s.study(); s.think(); } } interface LivingBeings{ void breathe(); } interface Animals extends LivingBeings{ void eat(); void sleep(); } 1 / 11 interface Persons extends Animals{ void think(); void study(); } class students implements Persons{ String name; public void breathe(){ System.out.println( 人要呼吸 ); } public void eat(){ System

文档评论(0)

1亿VIP精品文档

相关文档