看板 java 關於我們 聯絡資訊
我想問當我一開始輸入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
cyclone350:is it? http://ppt.cc/wJSc 05/09 00:29