基本功能定义在类中,扩展功能定义在接口中
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(){}
}
基本功能定义在类中,扩展功能定义在接口中
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(){}
}