[問題] 二維陣列複製貼上輸入的問題
我想問當我一開始輸入3
再輸入三串數列都可以正常OUTPUT
1 2 3 4 5 6
2 3 4 5 6 1
3 4 5 6 1 2
但如果我是用複製貼上那三行數列的話
它卻不能完全抓取到三串數列這是怎麼回事?
(剛接觸JAVA的新手)
int i;
int num;
String str1;
System.out.println("請輸入n");
Scanner c = new Scanner(System.in);
num = c.nextInt();
String array[][] = new String[num][6];
for(int x=0;x<num;x++){
System.out.println(x);
Scanner scanner = new Scanner(System.in);
str1 = scanner.nextLine();
String str2[]=str1.split(" ");
i=0;
for(int y=0 ; y<6 ; y++ ){
array[x][y] = str2[i];
i++;
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.118.170.243
※ 文章網址: http://www.ptt.cc/bbs/java/M.1399565485.A.4AD.html
→
05/09 00:29, , 1F
05/09 00:29, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章