java[Ljava.lang.String;@5d79a22d结果
当我运行程序并输入输入时,结果是[Ljava.lang.String;@5d79a22d
我不知道这意味着什么,也不知道为什么会发生。
这是我计划的一部分:
Scanner s = new Scanner(System.in);
//first input
System.out.println("Enter your first input: ");
String first = s.nextLine();
String[] firstsplit = first.split(", ");
//second input
System.out.println("Enter your second input: ");
String second = s.nextLine();
String[] secondsplit = second.split(", ");
//third input
System.out.println("Enter your third input: ");
String third = s.nextLine();
String[] thirdsplit = third.split(", ");
//fourth input
System.out.println("Enter your fourth input: ");
String fourth = s.nextLine();
String[] fourthsplit = fourth.split(", ");
//fifth input
System.out.println("Enter your fifth input: ");
String fifth = s.nextLine();
String[] fifthsplit = fifth.split(", ");
//declares array of numbers for whites with given numbers
String[] subset1white= Arrays.copyOfRange(firstsplit, 1, Integer.parseInt(firstsplit[0]));
System.out.println(subset1white);
任何帮助都将不胜感激
# 1 楼答案
这是因为您正在调用正则数组的
toString
方法试试这个:
# 2 楼答案
您应该使用^{} 方法,如下所示:
一定要把
在你们班上名列前茅。默认情况下,打印数组将使用^{}'s ^{} method ,返回
Arrays.toString(Object[])
将返回如下字符串: