InetAddress Equals() Example
Compares this object against the specified object.
InetAddressclass Equals() method example. This example shows you how to use Equals() method.This method Compares this object against the specified object.
Here is the code:-
/*
* @Program that Compares this object against the specified object.
* Equals.java
* Author:-RoseIndia Team
* Date:-19-Jun-2008
*/
import java.net.*;
public class Equals {
public static void main(String[] args)throws UnknownHostException {
InetAddress ia = InetAddress.getLocalHost();
InetAddress ia1 = InetAddress.getByName("girish-desktop");
//Compares this object against the specified object
System.out.println("Object same: "+ia.equals(ia1));
}
} |
|