Java Java Data Structures Organizing Data Interfaces

Why did the equals() method work?

At 7:56, he used the equals() method to compare "other" to what?

3 Answers

Trent Christofferson
Trent Christofferson
14,920 Points

he is seeing if it is equal to the current class he is in. It is the same as

this.equals(other)

Yep, even in java doc there is no such example. Always is somethingX.equals(somethingY). A little bit confusing.

Simone Ruffini
Simone Ruffini
3,013 Points

But he never defined the procedure of this method. How it can know how to equal stuff?