- Construct a URL object from a URL starting with the http or ftp
prefix
URL u = new URL("http://java.sun.com/index.html");
- Use the URL's openConnection() method to get the URLConnection
URLConnection connection = u.openConnection();
- Call the getInputStream method to obtain an input stream
InputStream instream = connection.getInputStream();
- You can turn the stream into a scanner in the usual way