标签:blog java 代码 div ar new amp log
class Parent{ int num = 8;// ->3 Parent(){ //super(); // ->2 //显示初始化 // ->3 //构造代码段 // ->4 show(); // ->5 } {// ->4 System.out.println("Parent constructor code run->"); } public void show(){//被覆盖 System.out.println("num = " + num); } } class Child extends Parent{ int num = 9;// ->6 Child(){ super();// ->1 //显示初始化 ->6 //构造代码段 ->7 num = 10; // ->8 System.out.println("after Child constructor code && Child constructor num = " + num);// ->9 } {// ->7 System.out.println("Child constructor code run->"); System.out.println("after Child constructor num = " + num); } public void show(){ System.out.println("num = " + num); } } public class PC{ public static void main(String[] args){ new Child(); } }
标签:blog java 代码 div ar new amp log
原文地址:http://www.cnblogs.com/hujunzheng/p/3872599.html