从URL读取并存储在JAVA中的ArrayList中

Tim*_*sey 0 java

我正在尝试从下面的URL中读取它似乎工作,但当我尝试将其存储在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();
   }
 }
Run Code Online (Sandbox Code Playgroud)

ada*_*ost 6

你忘了实例化了ArrayList<String>.