- 数组是引用传递
public class HelloWorld {
public static void main(String[] args){
// 数组是引用数据类型;就一定会发生引用传递;
int data [] = new int [] {10,20,30};
int temp [] = data;
temp [0] = 99;// data[0]会跟着改变;
//System.out.println(data);// 数组无法直接输出;
System.out.println("数组长度" + data.length);
for(int x = 0;x < data.length;x++){
System.out.println(data[x]);
}
}
}
- 结果
数组长度3
99
20
30
标签:int,System,6.2,数组,println,out,data,引用
From: https://www.cnblogs.com/pansidong/p/17454097.html