Write
a program for displaying information about
various parts of the URL
import java.net.*;
class example
{
public static void main(String agrs[])
throws MalformedURLException
{
URL obj = new
URL("http://www.yahoo.com:80/index.html");
System.out.println(" the protocol in
the url is :"+ obj.getProtocol());
System.out.println("the port in the
url is :"+ obj.getPort());
System.out.println("the host in the
url is :"+ obj.getHost());
System.out.println("the file in the
url is :"+ obj.getFile());
}
}