URLConnection classes encapsulate much of the complexity of retrieving information from a remote site. You can construct a
URL object from a string:
URL url = new URL(urlString);
If you simply want to fetch the contents of the resource, use the
openStream method of the
URL class. This method yields an
InputStream object. Use it in the usual way, for example, to construct a
InputStream inStream = url.openStream(); Scanner in = new Scanner(inStream);
java.net package makes a useful distinction between URLs (uniform resource locators) and URIs (uniform resource identifiers).
A URI is a purely syntactical construct that contains the various parts of the string specifying a web resource. A URL is a special ...