Home » JAVA Programming » Modifier Types » Question
  1. Can a class be declared with protected modifier?
    1. False
    2. True
    3. NA
    4. NA
    5. NA
Correct Option: A

Protected class member (method or variable) is like package-private (default visibility), except that it also can be accessed from subclasses. Since there is no such concept as ‘subpackage’ or ‘package-inheritance’ in Java, declaring class protected or package-private would be the same thing.



Your comments will be displayed only after manual approval.