Java Enum hashCode() MethodThe hashCode() method of Enum class returns a hash code for this enum. SyntaxParametersNA OverrideThe hashCode() method of Enum class overrides the hashCode() method of Object class. Return ValueThehashCode() method returns a hash code for this enum. Example 1Output: Hash code for winter = 248609774 Hash code for summer = 708049632 Hash code for spring = 1887400018 Hash code for rainy = 285377351 Hash code for autumn = 344560770 Example 2Output: red = 1338823963 green = 1156060786 blue = 1612799726 orange = 1286084959 Example 3Output: hash code of red =708049632 hash code of Red =1887400018 hash code of REd =285377351 hash code of RED =344560770 708049632 is greater. Next TopicJava-enum-name-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India