The URL class enables you to get resource from remote system. After creating a URL object you can retrieve information stored in URL in one of three ways.
Use the getCotenet() method in the URL class to fetch the URL’s content directly
Use openConnection method to get URLConnection to the URL
Use openStream() method to get an InputStream to the URL
The full URL string is the form you are probably most familiar with URL homepage=new URL(“http://www.yahoo.com”):
You can create URL by giving the protocol, host name, filename, and an optional port number
URL homepage=new URL(“http”,”www.yahoo.com”, 80);
