Question 11 · 200 in bank
Given:
And given the code fragment: Book book1 = new EBook(); book1.readBook(); Which option enables the code to compile?
Show answer
Answer: D
Explanation
The answer is letter D, answers A and B are clearly wrong, C would also be right, but what shows that it is wrong is the code fragment that calls the class directly. You cannot instantiate abstract classes directly as it was done in the code snippet, so the letter D is correct, implement the abstracted method.
Source: Adapted from community discussion — iSnover
