代码:
public static void main(String[] args) {
System.out.println(test(13549));
}
public static int test(int a){
if(a<10)
return a;
int b = (a%10);
int c = test(a/10);
int d = Math.max(b,c);
return d;
}
我了解该方法的作用(在使用调试器之后)并且我了解该方法会调用自身直到它小于 10 并且它运行并检查更大的 b 或 c。现在我不明白的是,为什么当有 return 语句return d;
时它返回int c = test(a/10)
而不是int test(int a){
.