Given the following class declarations: public abstract class Animal public interface Hunter public class Cat extends Animal implements Hunter public class Tiger extends Cat
Which answer fails to compile?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Answer D:
As per the classes definitions, the Tiger is a Cat, but the Cat is not a Tiger. So we cannot add Cat classes to Tiger array list. Vice versa works though.
Correct answer should be D.
D fails and the compiler will ask you to cast new Cat() into Tiger.
Correct answer is D, you cannot add Cats to Tiger List