Sphere sphere1 = new Sphere();
Sphere sphere2 = sphere1;
if (sphere1.equals(sphere2)) {
   System.out.println("sphere1 and sphere2 are the " +
                      "same object");
}
else {
   System.out.println("sphere1 and sphere2 are " +
                      "different objects");
}  // end if




Sphere sphere1 = new Sphere(2.0);
Sphere sphere3 = new Sphere(2.0);
if (sphere1.equals(sphere3)) {
   System.out.println("sphere1 and sphere3 have " +
                      "the same radius");
}
else {
   System.out.println("sphere1 and sphere3 have " +                         
                      "different radii");
}  // end if




public boolean equals(Object rhs) {
   return ((rhs instanceof Sphere) && 
          (theRadius == ((Sphere)rhs).theRadius));
}  // end equals

