我有一个程序,但我不理解它的结果。它给了我 110
,但我不知道怎么可能。我只调用了一次。对我来说,应该是3?谢谢。
public class Test {
public static String operator (int n) {
return((n == 0) ? "" : operator(n / 2) + (n % 2));
}
public static void main(String[] args) {
System.out.println(operator(6));
}
}
operator(n/2)+(n%2)
。operator()
返回什么? - Paul