public class Example{ String str=new String("good"); char[]ch={'a','b','c'}; public static void main(String args[]){ Example ex=new Example(); exchange(exstr,exch); Systemoutprint(exstr+" and "); Sytemoutprint(exch); } public void change(String str,char c[]){str="test ok"; ch[0]='g'; } }
A、 good and abc B、 good and gbc C、test ok and abc D、 test ok and gbc
为什么选A?
经过验证,是选B的 答案错了
ch[0]='g'; 这不是改变对象的值了吗?