对于以下代码行:
public class Base{
private int num1 = 0;
private int num2 = 0;
private static int dif = 0;
public Base(int num){
this(num,num+1);
System.out.println("Base constructor1");
}
public Base(int num1, int num2){
System.out.println("Base constructor2");
this.num1 = num1;
this.num2 = num2;
dif = num2 - num1;
}
public int sum(){
return num1 + num2;
}
public static int getDif(){
return dif;
}
}
那两行应该打印什么?
Base b1 = new Base(10);
Base b2 = new Base(4,7);
我认为,如果我能理解以下这句话: this(num,num+1);
我会理解一切......
谢谢