PPT Slide
The equals( ) method is therefore useful in comparing objects. Here’s an example of a typical equals( ) method:
// same accessor/modifier methods seen in previous slides
public boolean equals (Object oTemp) {
if (oTemp instanceof Box) {
if ( getLength() == bTemp.getLength() &&
getWidth() == bTemp.getWidth() &&
getHeight() == bTemp.getHeight() )