### Question:
Enum implements Serializable { @Override public int hashCode() { return name.hashCode(); } protected  Enum(String name); String getName(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testHashCode() { Enum enum1 = new Enum("enum1") { private static final long serialVersionUID = 1L; }; Enum enum2 = new Enum("enum1") { private static final long serialVersionUID = 1L; }; Enum enum3 = new Enum("enum3") { private static final long serialVersionUID = 1L; }; assertEquals(enum1.hashCode(), enum1.hashCode()); assertEquals(enum1.hashCode(), enum2.hashCode()); assertFalse(enum1.hashCode() == enum3.hashCode()); }