Getting the contents of a URL in Java

import java.net.*;
import java.io.*;
 
class UrlDemo1
{
   public static void main(String [] args)
   {
      try
      {
         // step1: make a url object
         URL u=new URL("http:/C:/lbs/first.html");
 	
	 // step2: make a file object 
         // using the getFile method of the url class
         File f=new File(u.getFile());
         System.out.println(f.getName());//verify the name
         System.out.println(f.exists());//verify if the file exists
 
         // step3: start a datainputstream  and 
         // read from it and print
         DataInputStream dis =new DataInputStream(new FileInputStream (f));
         while(dis.readLine()!=null)
            System.out.println(dis.readLine());
      }
      catch(Exception e)
      {
         System.out.println(e);
      }
   }
}