Identify the modifier which cannot be used for constructors.

Java MCQ: Identify the modifier which cannot be used for constructors.

a) private
b) protected
c) final
d) public

Answer:

c) final

Explanation:

The final modifier cannot be applied to constructors in Java because constructors are not inherited, and hence, there’s no point in preventing inheritance. Other access modifiers like private, protected, and public can be used.

Reference links:

https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top