0
我試圖從下面的URL中讀取似乎工作,但當我嘗試將其存儲在ArrayList它給我一個錯誤。有什麼想法導致錯誤?從一個URL讀取並存儲在一個ArrayList中的JAVA
public abstract class ItemList implements ItemListInterface{
private static String inputLine;
private static ArrayList<String> wordArray;
public static void main(String[] args) throws Exception {
URL wordList = new URL("http://dl.dropbox.com/u/18678304/2011/BSc2/phrases.txt");
BufferedReader in = new BufferedReader(
new InputStreamReader(
wordList.openStream()));
while ((inputLine = in.readLine()) != null){
System.out.println(inputLine);
wordArray.add(inputLine);
}
in.close();
}
}
向我們顯示錯誤。 – trojanfoe
存儲時你收到了什麼錯誤信息? –
打印第一個單詞「aaa」 –