public Recursion(){
dex=getValue(17);
}
public int getValue(int dexValue){
if (dexValue>100)
return dexValue;
else
return getValue(dexValue*2);
}
public static void main (String[] arguments){
Recursion r=new Recursion();
System.out.println(r.dex);
}
}
public Recursion(){
dex=getValue(17);
}
public int getValue(int dexValue){
if (dexValue>100)
return dexValue;
else
return getValue(dexValue*2);//因为当dexValue不大于100的时候会一直调
//用 public int getValue(int dexValue),直到满足条件也就是17*2*2*2=136
//然后才会将136返回给dex所以打印的是136
}
public static void main (String[] arguments){
Recursion r=new Recursion();
System.out.println(r.dex);
}
}