0

I'm trying to read from the URL below which appears to work but when I try to store it in the ArrayList it gives me an error. Any ideas on whats causing the error?

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();
   }
 }
2
  • what error message you are getting while storing? Commented Oct 7, 2011 at 10:40
  • aaa Exception in thread "main" java.lang.NullPointerException at ie.wit.bsc2.autosuggest.ItemList.main(ItemList.java:24) Commented Oct 7, 2011 at 10:42

1 Answer 1

6

You forget to instantiate the ArrayList<String>.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.