# equals()

A method used to test whether two objects have equal content.

## What does **equals()** do in Java?

**equals()** — A method used to test whether two objects have equal content.

```java
class AnswerChecker {
    boolean isYes(String answer) {
        return answer.equalsIgnoreCase("yes");
    }
}
```

Level: Apprentice · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/apprentice)

Updated: September 27, 2026

## In other subjects

- [Equals() in C#](https://www.ask-codey.com/glossary/equals-c-sharp)

Source: https://www.ask-codey.com/glossary/equals
