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

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

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


What kind of methods in Java do not behave polymorphically?

  1. Abstract methods

  2. Final methods

  3. Public methods

  4. Protected methods

The correct answer is: Final methods

Final methods in Java do not behave polymorphically because they cannot be overridden in the subclasses. Therefore, only the original method defined in the superclass will be executed, regardless of the subclass instance used to call the method. This means that the behavior of the method cannot be changed in different subclasses, making it non-polymorphic. Abstract methods, on the other hand, must be overridden in subclasses and therefore have multiple implementations, making them polymorphic. Public and protected methods can be overridden and have different implementations in subclasses, making them also behave polymorphically.