new Child();new Child(1);

mischen520發表於2017-08-09
/**
 * 
 */
package com.mischen.cn;

/**
 * @author mischen
 *
 */
public class Child extends Parent{
    private Child(){
    	this(1);
    	System.out.print("B");
    }
    protected Child(int i){
    	System.out.print("C");
    }
	public static void main(String[] args) {
		new Child();//ACB
		new Child(1);//AC
	}
}
class Parent{
	public Parent(){
		System.out.print("A");
	}
}

相關文章