public static void main (String args[]) {
Scanner io = new Scanner(System.in);
int a = io.nextInt();
io.nextLine();
for(int i = 0; i < a; i++) {
String input = io.nextLine();
String[] splitArr = input.split("\\s+");
int p[] = new int[input.length()];
int q = 0;
for (String par : splitArr) {
System.out.println(par);
p[q++] = Integer.parseInt(par);
System.out.println(p);
}
Sort(p);
}
}
輸入:2 121213意外輸出而分裂和解析字符串轉換成int(Java)的
輸出:121213 [I @ 1f96302
最後一行示出了存儲陣列在p []中。這是不正確的。幫助他人!
你的意思是打印的System.out.println(對[q])? – user7294900
歡迎來到Stack Overflow!請參考[遊覽](http://stackoverflow.com/tour),環顧四周,並閱讀[幫助中心](http://stackoverflow.com/help) ,特別是[如何做我問一個好問題?](http://stackoverflow.com/help/how-to-ask)和[我可以問什麼主題?](http://stackoverflow.com/help/on-topic) 。 –