📜  Java |功能|问题3

📅  最后修改于: 2021-06-30 00:14:31             🧑  作者: Mango

class Test {
public static void swap(Integer i, Integer j) {
      Integer temp = new Integer(i);
      i = j;
      j = temp;
   }
   public static void main(String[] args) {
      Integer i = new Integer(10);
      Integer j = new Integer(20);
      swap(i, j);
      System.out.println("i = " + i + ", j = " + j);
   }
}

(A) i = 10,j = 20
(B) i = 20,j = 10
(C) i = 10,j = 10
(D) i = 20,j = 20答案: (A)
说明:参数在Java按值传递
这个问题的测验