作者cyberwizard (Gavin)
看板java
標題Re: [問題] 想請問這段編譯哪裡有問題??
時間Fri Apr 20 17:12:57 2012
※ 引述《d1288999 (@凌凌七@)》之銘言:
: import java.io.
: import java.util.*;
: public class test12 {
: public static void main(String[] args){
: System.out.println("請輸入九個數字");
: int[] x = new int[9];
ArrayList<Integer> x = new ArrayList<Integer>()
: Scanner sc = new Scanner(new BufferedInputStream(System.in));
: while(sc.hasNext()) {
while(sc.hasNextInt()){
多餘的 for-loop
: for(int i=0;i<9;i++){
: x[i]=sc.nextInt();
: }
改成
x.add(sc.nextInt);
: }
: }
: }
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.85.140
推 PsMonkey:請不要這麼直白的幫助版友...... Orz 04/20 17:58
→ cyberwizard:還好吧,該有的元素他都有了,只是點出問題 04/20 18:55