Java InetAddress.hashCode()

Syntax

InetAddress.hashCode() has the following syntax.

public int hashCode()

Example

In the following code shows how to use InetAddress.hashCode() method.


/*from w w  w .  ja v a 2  s  .c  o m*/
import java.net.InetAddress;

public class Main {
  public static void main(String[] argv) throws Exception {
    byte[] ipAddr = new byte[] { 127, 0, 0, 1 };
    InetAddress addr = InetAddress.getByAddress(ipAddr);
    System.out.println(addr.hashCode());
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.net »




CookieManager
CookiePolicy
CookieStore
DatagramPacket
DatagramSocket
HttpCookie
HttpURLConnection
InetAddress
JarURLConnection
MulticastSocket
ServerSocket
Socket
SocketAddress
URI
URL
URLConnection
URLDecoder
URLEncoder