interface MyInterfaceOne {
abstract public void run();
}
interface MyInterfaceTwo
{
abstract public void speak();
}
//接口实现多继承
public class Demo implements MyInterfaceOne,MyInterfaceTwo{
public static void main(String[] args) {
Demo demo = new Demo();
demo.run();
demo.speak();
}
public void run() {
System.out.println("跑啊跑");
}
@Override
public void speak() {
// TODO Auto-generated method stub
System.out.println("说啊说");
}
}
Java接口
最新推荐文章于 2022-04-16 18:35:47 发布