首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

可以多兑现,不可以多继承-安全原因

2012-12-28 
可以多实现,不可以多继承---安全原因/*abstract class Demo{abstract void show()abstract void func()}

可以多实现,不可以多继承---安全原因

/*abstract class Demo{abstract void show();abstract void func();}*/interface Demo{public static final int x = 4;public abstract void show();public abstract void func();}class DemoImpl implements Demo{public  void show(){}public  void func(){}}class  InterDemo{public static void main(String[] args) {DemoImpl di = new DemoImpl();di.show();System.out.println(di.x);System.out.println(DemoImpl.x);System.out.println(Demo.x);}}/*class A{void show(){System.out.println("a");}}class B{void show(){System.out.println("B");}}class C extends A,B{}main(){C c = new C();c.show();//不确定.}*/interface A{void show();}interface B{void show();}interface E extends A,B{}class D{}class C extends D implements A,B{public void show(){}}interface Smoking{void smoke();}abstract class XueYuan{void sleep(){}abstract void study();}class Ls extends XueYuan implements Somking{void study(){}public void smoke(){}}class Wu extends XueYuan{void study(){}}
?

热点排行