接口实例展示

基本功能定义在类中,扩展功能定义在接口中

class Student {

  abstract void study();

  void sleep(){

System.out.println("sleep")

}

}

interface Smoking{

void smoke();

}

class ZhangSan extends Student implements Smoking{

  void study(){}

  public void smoke(){}

}

原文地址:https://www.cnblogs.com/guaikakani/p/10696485.html