Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Question: 1 / 50

What keyword is used in Java to make a class member unable to be changed?

Yes

In Java, if a method is marked as final, it means that it cannot be overridden in any subclass. This is to prevent subclasses from changing the functionality or implementation of the final method. Therefore, the correct answer is A as all methods in a base class, including final methods, can be inherited by a derived class but they cannot be overridden. Incorrect answers include B, as stated previously, final methods cannot be overridden, and C and D, as the rules for overriding final methods also apply to static and inner classes, meaning they cannot be overridden either.

No

Only if it's static

Only in inner classes

Next

Report this question