Google News
logo
Java Constructor - Interview Questions
what will happen when a constructor is declared as protected?
Generally, when we declare a method as protected, other classes can access that method in a different package by using inheritance only. But, when we declare a constructor protected, it behaves slightly differently than a method. The protected constructor can only be accessed by using a super keyword according to Java language standards.
Advertisement