import java.net.*; import java.io.*; public class UrlWords { public static void main(String args[]) { if (args.length != 1) { System.out.println("usage: test "); } else { WordIterator wit = null; URL u = null; try { u = new URL(args[0]); } catch (MalformedURLException e){ System.err.println(e + " **ERROR opening " + args[0]); } try{ wit = new WordIterator( new InputStreamReader(u.openStream())); } catch (Exception e){ System.err.println(e + " **ERROR opening " + args[0]); } while (wit.hasNext()) { System.out.println(wit.next()); } } } }