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.


Can constructor in Java be overridden?

  1. Yes

  2. No

  3. Only if it is a default constructor

  4. Only in a subclass

The correct answer is: No

In Java, constructors cannot be overridden. This is because unlike methods, constructors cannot be inherited by subclasses. This means that a subclass cannot override the constructor of its superclass. However, a subclass can specify which constructor of the superclass should be invoked when creating an instance of the subclass. Option A is incorrect because constructors cannot be overridden, but can be invoked through the use of the super keyword. Option C is incorrect because the type of a constructor (default or non-default) does not affect its ability to be overridden. Option D is incorrect because as stated, constructors cannot be overridden in Java.