Object: hashCode()
/*
About to hashCode 2 objects.
MainClass@cf2c80 --> 13577344
java.awt.Color[r=68,g=136,b=204] --> -12285748
*/
public class MainClass {
/** Some objects to hashCode() on */
protected static Object[] data = { new MainClass(), new java.awt.Color(0x44, 0x88, 0xcc) };
public static void main(String[] args) {
System.out.println("About to hashCode " + data.length + " objects.");
for (int i = 0; i < data.length; i++) {
System.out.println(data[i].toString() + " --> " + data[i].hashCode());
}
}
}
Related examples in the same category