Proxy ToString() Example

Started by VelMurugan, Dec 30, 2008, 11:32 PM

Previous topic - Next topic

VelMurugan

Proxy ToString() Example

Constructs a string representation of this Proxy.

Proxyclass ToString() method example. This example shows you how to use ToString() method.This method Constructs a string representation of this Proxy.

Here is the code:-


/*
* @Program that Returns a string representation of this object.
* ToString.java
* Author:-RoseIndia Team
* Date:-23-Jun-2008
*/

import java.net.*;

public class ToString {

    public static void main(String[] args) {
        SocketAddress ss = new InetSocketAddress("girish-desktop", 8080);
        Proxy p = new Proxy(Proxy.Type.SOCKS, ss);
        //Returns a string representation of this object.
        String s = p.toString();
        System.out.println("String representation of this object is: " + s);
    }
}


Output of the program:-

String representation of this object is: SOCKS @ girish-desktop/127.0.1.1:8080

Source : codingdiary