Java Enum equals() MethodThe equals() method of Enum class returns true if this enum object is same as the defined object. SyntaxOverrideThe equals() method of Enum class overrides the equals() method of class Object. Parametersother -It is the object to be compared with this enum. Return ValueThe equals() method returns true if the defined object is equal to this enum. Example 1Test it NowOutput: red and reD are not equal because of case sensitivity Example 2Output: Choose amongst the following: Stone Paper Scissor # Example 3Test it NowOutput: Q In which movie Shah rukh khan has played a dual role ? Ans. Don Your answer is correct.
Next TopicJava Enum
|