Java Enum equals() Method

The equals() method of Enum class returns true if this enum object is same as the defined object.

Syntax

Override

The equals() method of Enum class overrides the equals() method of class Object.

Parameters

other -It is the object to be compared with this enum.

Return Value

The equals() method returns true if the defined object is equal to this enum.

Example 1

Output:

red and reD are not equal because of case sensitivity

Example 2

Output:

Choose amongst the following:
Stone
Paper
Scissor
#

Example 3

Output:

Q In which movie Shah rukh khan has played a dual role ?
Ans. Don
Your answer is correct.