Object.hashCode() has the following syntax.
public int hashCode()
In the following code shows how to use Object.hashCode() method.
/*from www . ja v a 2s. c om*/ 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()); } }
The code above generates the following result.