url in java
To understand url-uniform resource locator operations in java just run this program ...
import java.net.*;
import java.io.*;
class url
{
public static void main(String args[]) throws Exception
{
URL p1=new URL("http://www.oracle.com:80/docs/path#up");
System.out.println("Protocol:"+p1.getProtocol());
System.out.println("Host :"+p1.getHost());
System.out.println("File Name :"+p1.getFile());
System.out.println("Port :"+p1.getPort());
System.out.println("Reference :"+p1.getRef());
}
}
Comments
Post a Comment