Question:What would happen on trying to compile and run the following code?
class House { public final void MaintainMethod() { System.out.println("MaintainMethod"); } } public class Building extends House { public static void main(String argv[]) { House h = new House(); h.MaintainMethod(); } }
A A runtime error will occur because class House is not defined as final.
B Successful compilation and output of "MaintainMethod" at run time.
C A compilation error indicating that a class with any final methods must be declared final itself.
D A compilation error indicating that you cannot inherit from a class with final methods.
+ AnswerB
+ Report