1.

What is true about protected constructor?(a) Protected constructor can be called directly(b) Protected constructor can only be called using super()(c) Protected constructor can be used outside package(d) protected constructor can be instantiated even if child is in a different packageI got this question during an interview.Question is from Constructor in chapter Classes and Methods of Java

Answer»

Right choice is (b) Protected constructor can only be called using SUPER()

The best EXPLANATION: Protected access modifier means that constructor can be accessed by child CLASSES of the parent class and classes in the same PACKAGE.



Discussion

No Comment Found

Related InterviewSolutions