ExamVeda
Login
Home
Constructors and Methods
?

Which of the modifier can't be used for constructors?

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

2 Comments
NITIN CHAUDHARY
NITIN CHAUDHARY 9 years ago
It’s actually pretty simple to understand – Everything that is marked static belongs to the class only, for example static method cannot be inherited in the sub class because they belong to the class in which they have been declared. Refer static keyword.
Lets back to the point, since each constructor is being called by its subclass during creation of the object of its subclass, so if you mark constructor as static the subclass will not be able to access the constructor of its parent class because it is marked static and thus belong to the class only. This will violate the whole purpose of inheritance concept and that is reason why a constructor cannot be static.
Nitin Thakur
Nitin Thakur 9 years ago
only public private protected and default modifiers are allowed for a constructor, Neither final or static is allowed.