Think in java 答案

    技术2022-05-11  54

    阅前声明: http://blog.csdn.net/heimaoxiaozi/archive/2007/01/19/1487884.aspx 

    /****************** Exercise 10 ***************** * Create a class with two (overloaded) * constructors. Using this, call the second * constructor inside the first one. ***********************************************/public class E10_ThisConstructorCall {  public E10_ThisConstructorCall(String s) {    System.out.println("s = " + s);  }  public E10_ThisConstructorCall(int i) {    this("i = " + i);  }  public static void main(String args[]) {    new E10_ThisConstructorCall("String call");    new E10_ThisConstructorCall(47);  }}

    //+M java E10_ThisConstructorCall

     


    最新回复(0)