2011-10-07 4 views
0

아래 보이는 URL에서 읽으려고하는데 ArrayList에 저장하려고하면 오류가 발생합니다. 오류의 원인에 대한 아이디어가 있습니까?URL에서 읽기 및 Java ArrayList에 저장

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(); 
    } 
} 
+0

오류를 보여주십시오. – trojanfoe

+0

저장하는 동안 어떤 오류 메시지가 나타 납니까? –

+0

첫 번째 단어 "aaa"를 인쇄합니다. –

답변

6

당신은 ArrayList<String>를 인스턴스화하는 것을 잊지.

관련 문제