面試題


public class TestWS {

 public static  void main(String args[]) {
  Test t = new Test();
  t.i = 20;
  method(t, t.i);
  System.out.println(t.i);
 }
 
 public static void method (Test t, int i) {
  i = 0;
  t.i = 30;
  Test tt = new Test();
  t = tt;
  System.out.println(t.i + " " + i);
 }
 
}

class Test{
 int i = 10;
}

 

打印出的結果是 10 0 30

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章