Record answers on separate piece of paper.
Assignment: #FinalAssessmentPractice Due: 15 minutes Points: 0

The questions in this assessment use the following.

      class R { ... }
      class A extends R { ... }
      abstract class B extends R { ... }
      final class C extends R { ...}
      class D extends A { ... }
      class E extends B { ... }
      class F extends B { ... }
      // none of the classes implement a toString() method

[0] Draw a class hierarchy for the classes defined above.

[1] No or Yes:  class R extends Object

[2] class G extends C   does not compile. Why?

[3] class G extends E, F   does not compile. Why?

[4] B doh = new B();   does not compile. Why?

[5] System.out.println(new R());   prints: R@6bc7c054   Why?

[6] No or Yes:  class D can have subclasses (children).

[7] If  public String toString() { return "Arizona"; }  
    is added to class A, then System.out.println(new D()); 
    prints what?

[8] Assume the following is added to class C.

    public String toString() { 
       int azAgeIn2018 = 2018 - 1912;
       return "Arizona is " + azAgeIn2018 + " years young!";
    }

    What does System.out.println(new C()); print?

[9] System.out.println(new R().hashCode());  prints: 1808253012.
    No  public int hashCode()  method is implemented in class R.
    Briefly explain why this compiles and runs?

[10] If  public int hashCode() { return 48; }  is added to 
     class R, then what does the following statement print?

     System.out.println("Arizona is state# " + new R().hashCode());