Question) Methods which are marked protected can be accessed only by classes within the same package
Options)
Explanation) I would recommend go through the post on Access Modifiers in Java Tutorials section.If a member (be it a member variable or a member function) is defined to be protected then it is accessible by members in same class, in same package and also in all the sub classes of class in which the protected member is defined. So it is not just the same package.Hence answer is False.
Options)
- True
- False
Explanation) I would recommend go through the post on Access Modifiers in Java Tutorials section.If a member (be it a member variable or a member function) is defined to be protected then it is accessible by members in same class, in same package and also in all the sub classes of class in which the protected member is defined. So it is not just the same package.Hence answer is False.
No comments:
Post a Comment