public boolean equals(Object o) { if (o instanceof Circle) { Circle a = (Circle) o; if (this.radius == a.radius) return true; // This would work just as well: // return this.radius == a.radius; } return false; }