URLConnection getURL Example
URLConnection class getURL example. This example shows you how to use getURL method.
URLConnection class getURL example. public URL getURL() Returns the value of this URLConnection's URL field.
Here is the code
/*
* @ # GetURL.java
* A class repersenting use to GetURL method
* of URL class in java.net package
* version 24 June 2008
* author Rose India
*/
import java.net.*;
public class GetURL {
public static void main(String args[]) throws Exception {
SocketAddress address = new InetSocketAddress("192.168.10.80", 9090);
Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
URL url = new URL("http://google.com");
URLConnection connection = url.openConnection(proxy);
System.out.println("URL "+connection.getURL());
}
} |
|