Given:
Which line of code results in a compilation error?
Given:
Which line of code results in a compilation error?
The compilation error occurs on line n4. The reason is that the method 'method()' in the 'Sub' class is attempting to override the 'method()' in the 'Super' class. However, the 'method()' in the 'Super' class is declared as 'final', which means it cannot be overridden. This results in a compilation error.
Cannot override the final method from Super D is correct
this is ok ! final method cannot override
Tested: D.
Answer: D
true final method cannot be overridden