The equals method is defined in the Object class. Which of the following is correct to override it in the String class?

The equals method is defined in the Object class. Which of the following is correct to override it in the String class?


A. public boolean equals(String other)
B. public boolean equals(Object other)
C. public static boolean equals(String other)
D. public static boolean equals(Object other)

The correct answer is B


Java

Learn More Multiple Choice Question :