InetSocketAddress equals Example

InetSocketAddress class equals example. This example shows you how to use equals method.


InetSocketAddress class equals example. public final boolean equals(Object obj) Compares this object against the specified object. The result is true if and only if the argument is not null and it represents the same address as this object.

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

import java.net.*;

public class Equals {

    public static void main(String args[]) throws Exception {

        InetSocketAddress inetSocketAddress, inetSocketAddress1;

        inetSocketAddress = new InetSocketAddress("192.168.10.222"1313);
        inetSocketAddress1 = new InetSocketAddress("192.168.10.222"1313);
        System.out.println("inetSocketAddress and inetSocketAddress1 " +
                "is equals " + inetSocketAddress.equals(inetSocketAddress1));
    }
}

Output
inetSocketAddress and inetSocketAddress1 is equals true

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

HOME | COPYRIGHT | CONTACT US