作者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
1F:推 PsMonkey:请不要这麽直白的帮助版友...... Orz 04/20 17:58
2F:→ cyberwizard:还好吧,该有的元素他都有了,只是点出问题 04/20 18:55