57

问答题 57 /86

检查程序,是否存在问题,如果存在指出问题所在,如果不存在,说明输出结果。
package algorithms.com.guan.javajicu;
public class Example {
    String str = new String(“good”);
    char[] ch = {‘a’, ’b’, ’c’};
    public static void main(String[] args) {
        Exampleex = new Example();
        ex.change(ex.str, ex.ch);
        System.out.print(ex.str + ” and ”);
        System.out.print(ex.ch);
 }
 public void change(Stringstr, char ch[]) {
        str = “test ok”;
        ch[0] = 'g';
 }
}

参考答案

参考答案输出结果:goodandgbc