public boolean equals(Object o) {
if (!(o instanceof Box)) return false;
Box other = (Box) o;
return /* missing */;
}Which expression compares the width fields correctly?
- A
width.equals(other.width)
- B
this.width = other.width
- Ccheck_circle
this.width == other.width
- D
this == other
Explanation
width is an int field, so use == to compare values; .equals applies to objects, and = is assignment.