一道。。Java基础面试题

阅读 116

2023-03-16


package test;

public class ChangeValue {
String str = new String("Hello");
char[] cb = {'a', 'b', 'c'};

public void chnage(String str, char ch[]) {
str = "HelloWorld";
ch[0] = 'b';
ch[1] = 'b';
}
public static void main(String[] args) {
ChangeValue ex = new ChangeValue();
ex.chnage(ex.str,ex.cb);
System.out.println(ex.str);
System.out.println(ex.cb);
}
}

我觉得结果是 HelloWorld a,b,c

实际上是。。Hello b,b,c

一道。。Java基础面试题_System

 java基础有点废物啊。。得努力努力了

精彩评论(0)

0 0 举报