Inet4Address HashCode() Example

Returns a hashcode for IP address.


Inet4Addressclass HashCode() method example. This example shows you how to use HashCode() method.This method Returns a hashcode for IP address.

Here is the code:-
/* 
 * @Program that returns a hashcode for this IP address.
 * HashCode.java 
 * Author:-RoseIndia Team
 * Date:-28-Jun-2008
 */

import java.net.*;
import java.util.*;

public class HashCode {

    public static void main(String[] argsthrows Exception {
        InetAddress i = Inet4Address.getByName("localhost");
        int j = i.hashCode();
        System.out.println("Hashcode for this IP address is: " + j);
    }
}

Output of the program:-
 Hashcode for this IP address is: 2130706433

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

HOME | COPYRIGHT | CONTACT US