Engineering Full Stack Apps with Java and JavaScript
Which of the following method definitions will prevent overriding of that method?
Select 4 options
A. public final void m1() B. public static void m1() C. public static final void m1() D. public abstract void m1() E. private void m1()
A, B, C, E
A - final methods cannot be overridden. That is the purpose of the final keyword.
C - Keep in mind that static methods are not overridden, they are shadowed.
E - private methods are not inherited at all so there is no question of overriding a private method.
Logged in users see lesser ads and get more features.
If you want to solve the questions together with the experts and understand the concepts better, please contact us using the contact form or WhatsApp numbers. Selected people get to do that without any additional charges.