URLConnection toString Example

URLConnection class toString example. This example shows you how to use toString method.


URLConnection class toString example. public String toString() Returns a String representation of this URL connection.

Here is the code
/*
 * @ # ToString.java
 * A class repersenting use to ToString method 
 * of URL class in java.net package
 * version 24 June 2008
 * author Rose India 
 */

import java.net.*;

public class ToString {

    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://yahoo.com");
        URLConnection connection = url.openConnection(proxy);
        System.out.println(connection.toString());
    }
}

Output
sun.net.www.protocol.http.HttpURLConnection:http://yahoo.com

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US