Explain how to make a connection to a URL 
Connection to the remote object represented by the URL is only initiated when the connect() method of the URLConnection is called. Doing this initializes a communication link between your Java program and the URL over the network.
The following code show how a connection to a URL is made. 
try
{
   URL xyz = new URL(http://www.xyz.com/);
   URLConnection xyzConnection = xyz.openConnection();
   xyzConnection.connect();
}
catch (MalformedURLException e)
{ 
   // new URL() failed
   . . .
} 
catch (IOException e)
{
    // openConnection() failed
   . . .
}