我的问题是这样的如何在while循环填充数组列表
Scanner sf = new Scanner(f);
ArrayList<String> teamArr = new ArrayList<String>();
int counterPopulate = 0;
while(sf.hasNextLine()){
teamArr[counterPopulate] = sf.nextLine();
counterPopulate++;
}
的任何解决方案,这是一个尝试捕捉包围。 获取问题,在这部分teamArr[counterPopulate] = sf.nextLine();
语言是什么呢? –
因为'字符串'是大写的,它看起来像java –
你得到一个'索引越界'异常吗?如果没有,你会得到什么例外 –