Java Object.hashCode()

Syntax

Object.hashCode() has the following syntax.

public int hashCode()

Example

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


/* w  w  w  .jav a  2  s  .  co m*/
import java.util.GregorianCalendar;

public class Main {

   public static void main(String[] args) {
      GregorianCalendar cal = new GregorianCalendar();

      // print a hashcode for cal
      System.out.println(cal.hashCode());

   }
}




















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable