Method declared <code>Animal getAnimal()</code> can return
- A
Animal only
- B
Compile error if returning Dog
- Ccheck_circle
Animal or any subclass instance
- D
null only
Explanation
Subclass instance "is-an" Animal; can be returned.
AP Computer Science A· difficulty 4/5
Method declared <code>Animal getAnimal()</code> can return
Animal only
Compile error if returning Dog
Animal or any subclass instance
null only
Explanation
Subclass instance "is-an" Animal; can be returned.
Want 10 more like this — adaptive to your weak spots?