Section 11.10 Check Point Questions2 questions 

11.10.1
Does every object have a toString method and an equals method? Where do they come from? How are they used? Is it appropriate to override these methods?
11.10.2
When overriding the equals method, a common mistake is mistyping its signature in the subclass. For example, the equals method is incorrectly written as equals(Circle circle), as shown in (a) in following the code; instead, it should be equals(Object circle), as shown in (b). Show the output of running class Test with the Circle class in (a) and in (b), respectively.
public class Test {
  public static void main(String[] args) {
    Object circle1 = new Circle();
    Object circle2 = new Circle();
    System.out.println(circle1.equals(circle2));
  }
}

(a)
class Circle {
  double radius;

  public boolean equals(Circle circle) {
    return this.radius == circle.radius;    
  }
}

(b)
class Circle {
  double radius;

  public boolean equals(Object circle) {
    return this.radius == ((Circle)circle).radius;    
  }
}
If Object is replaced by Circle in the Test class, what would be the output to run Test using
the Circle class in (a) and (b), respectively?
Suppose that circle1.equals(circle2) is replaced by circle1.equals("Binding"), what would happen to run Test using the Circle class in (a) and (b), respectively? Reimplement the equals method in (b) to avoid a runtime error when comparing circle with a non-circle object.