Properties Of URL

1 comments - Post a comment

import java.net.*;

class Gotest
{
public static void main(String agrs[]) throws MalformedURLException
{
URL hp = new URL("http://www.javapgms.blogspot.com/Array.html");
System.out.println("Protocol : " +hp.getProtocol());
System.out.println("Port : " +hp.getHost());
System.out.println("Host : " + hp.getHost());
System.out.println("File : " +hp.getFile());
}
}

/*

getProtocol() : Returns the protocal identifier of the given URL object.
getPort() : Returns the integer value of the port number of the URL Object. If the port is not set the it returns -1.
getHost() : Returns The Host Name.
getFile() : Returns The file Name.
getRef() : Returns The reference component

 
This Post has 1 Comment Add your own!
Unknown - February 7, 2008 at 6:05 PM

Okies.

Post a Comment