我读到了几种打印阵列的方法,但无论我如何尝试,我都会打印出乱码。谁有人能告诉我幕后发生了什么?提前谢谢!
这是我得到的输出。 [[I @ 1520a9d6]
import java.util.Arrays;
import java.util.Scanner;
public class intarray {
public static void main(String[] args) {
System.out.println("Enter a number other than zero, then hit enter. Do this five times.");
Scanner input1 = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
Scanner input3 = new Scanner(System.in);
Scanner input4 = new Scanner(System.in);
Scanner input5 = new Scanner(System.in);
int[] array=new int[5];
int one=input1.nextInt();
array[0]=one;
int two=input2.nextInt();
array[1]=two;
int three=input3.nextInt();
array[2]=three;
int four=input4.nextInt();
array[3]=four;
int five=input5.nextInt();
array[4]=five;
input1.close();
input2.close();
input3.close();
input4.close();
input5.close();
System.out.print(Arrays.asList(array));
} }