如下程序的輸出結果是?數組
1 public class Example { 2 String str = new String("good"); 3 char[] ch = { 'a', 'b', 'c' }; 4 5 public static void main(String args[]) { 6 Example ex = new Example(); 7 ex.change(ex.str, ex.ch); 8 System.out.print(ex.str + " and "); 9 System.out.print(ex.ch); 10 } 11 12 public void change(String str, char ch[]) 13 { 14 str = "test ok"; 15 ch[0] = 'g'; 16 } 17 }
A 、 good and abc
B 、 good and gbc
C 、 test ok and abc
D 、 test ok and gbc
解析: