Java中输出整个数组的方法有以下几种:
int[] arr = {1, 2, 3, 4, 5};
System.out.println(Arrays.toString(arr));
int[] arr = {1, 2, 3, 4, 5};
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
int[] arr = {1, 2, 3, 4, 5};
for (int num : arr) {
System.out.print(num + " ");
}
System.out.println();