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

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

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


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

  1. Yes

  2. No

  3. Only if it's static

  4. Only in inner classes

The correct answer is: 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.