2 回答

TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊
你好好運(yùn)行一下看看,第二個(gè)輸出是:1,不是12。。。。
public class Test {
public static void main(String[] args) {
String[] s = { "M", "I", "S", "O", "A" };
String[] b = new String[6];
System.arraycopy(s, 0, b, 0, s.length);
b[2] = "asdasd";
System.out.println(s[2]);// s
System.out.println(b[2]);// asdasd
int[][] a = { { 1, 2, 3 }, { 2, 4, 5 }, { 1, 3, 4 } };
int[][] a2 = new int[3][3];
System.arraycopy(a[0], 0, a2[0], 0, a[0].length);
a2[0][0] = 12;
System.out.println(a[0][0]);// 1
}
}
添加回答
舉報(bào)