Reading from a URL and storing in an ArrayList in JAVA -
i'm trying read url below appears work when try store in arraylist gives me error. ideas on whats causing 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(); } }
you forget instantiate arraylist<string>
.
Comments
Post a Comment