78.2k views
0 votes
Which of the following is true about protected access?

A. Protected members may be accessed by methods in the same package or in a subclass, even when the subclass is in a different package.
B. Protected members are actually named constants.
C. Protected members may be accessed by methods in the same package or in a subclass, but only if the subclass is in the same package.
D. Protected members cannot be accessed by methods in any other classes.

User Rachit
by
5.7k points

1 Answer

4 votes

Answer:(A) Protected members may be accessed by methods in the same package or in a subclass, even when the subclass is in a different package.

Step-by-step explanation:

Methods,constructors and variables, that are protected in superclass they can be only accessed by any class within the package of the protected members class and methods in the same package or they can be of a subclass or the subclasses that may be present in other package .

User Kade Williams
by
4.7k points