在下面的代码中,为什么在method2中改变了原始数组,arr2[0]仍然等于1.5?忽略其他数组和变量。
public class Problem3
{
public static int method1(int[] array)
{
array[0] += 10;
return array[0];
}
public static int method2(int aNum, String aStr,
int[] array1, float[] array2, int[] array3)
{
float[] fNums = {1.5F, 2.5F};
array2 = fNums;
return 10 + method1(array3);
}
public static void main(String[] args)
{
int num = 1000;
String aStr = "Hello!";
int[] arr1 = {1, 2, 3};
float[] arr2 = {0.5F, 1.5F};
int[] arr3 = {5, 6, 7};
int retNum = method2(num, aStr, arr1, arr2, arr3);
System.out.println(arr2[0]);
}
}