首页 > 代码库 > 继承体系-代码体现

继承体系-代码体现

package demo;

public class ExtendDemo {

public void run(){
System.out.println("run");
}
}

--------------------------------------------------------

package demo;

public class FuDemo extends ExtendDemo{

public void show(){
System.out.println("show");
}
}

-----------------------

package demo;

public class ZiDemo extends FuDemo{

public void play(){
System.out.println("play");
}
}

-------------------------------

package demo;

public class Demo {

public static void main(String[] args) {
ZiDemo demo =new ZiDemo();
demo.play();
demo.run();
demo.show();
}
}

 

继承体系-代码体现