What statements are true about the following code? (Choose all that apply.)
public class Shape {} public class Animal { public String name; } public class Fish extends Animal { public Shape tail; } public class Whale extends Fish {}
A, B, D.
A is correct because name is public and therefore inherited by the Whale class.
B is correct because Whale is-a Fish and Fish has-a Shape; therefore, since tail is public, it is inherited and Whale has-a Shape.
C is incorrect, because Whale is not inherited from Shape.
D is correct, because Whale is-a Fish and Fish is-a Animal; therefore, Whale is-a Animal.
E is incorrect, because the relationship is reversed.
F is incorrect, since Animal does not have a Shape attribute.