Implement the following class hierarchy on paper. You do not need to
fill in the method bodies for the toss
or bounce
methods.
Answer the following questions:
equals
method than to overload it? Variable Type | ||||||
Tossable | Ball | Rock | Baseball | Football | ||
Object Type | Tossable | |||||
Ball | ||||||
Rock | ||||||
Baseball | ||||||
Football |
1. Ball ball = new Football("spalding"); 2. Ball ball = new Football("Spalding"); Baseball baseball = (Baseball)ball; 3. Object obj = new Baseball("spalding"); 4. Object obj = new Baseball("spalding"); Tossable tossable = obj; 5. Tossable tossable = new Baseball("spalding"); Object obj = tossable;