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

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

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

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 can be said about a final class in Java?

  1. It cannot be instantiated

  2. It cannot have methods

  3. It cannot be inherited

  4. It can only have static methods

The correct answer is: It cannot have methods

A final class in Java is a class that cannot be inherited and cannot have its internal states modified by any external classes. This means that Option A is incorrect as a final class can still be instantiated, but it cannot be used as a base class for any other classes to inherit from. Option C is also incorrect as a final class cannot be inherited by any other classes. Option D is incorrect because a final class can still have non-static methods, but those methods cannot be overridden by any subclass. Therefore, the only correct statement about a final class in Java is that it cannot have methods, which includes both static and non-static methods.