Java数组的初始化赋值有以下几种方法:
int[] arr = {1, 2, 3, 4, 5};
int[] arr = new int[5];
for (int i = 0; i < arr.length; i++) {
arr[i] = i + 1;
}
int[] arr = new int[5];
Arrays.fill(arr, 10);
int[] arr1 = {1, 2, 3, 4, 5};
int[] arr2 = Arrays.copyOf(arr1, arr1.length);