Which of these access specifiers can be used for a class so that its members can be accessed by a different class in the same package?
1) protected
2) default
3) private
4) public
These are MCQs. More than one option can be the answer.
Answers
Answered by
3
Answer:
4) public is the access specifiers that can be used for a class so that it's member can be access by other class
Answered by
0
1) Protected and 4) Public
Access specifiers:
Access specifiers are keywords in object-focused languages that set out access to classes, methods, and other members. Access specifiers are of three types:
- Private
- Public
- Protected
Protected: Protected members cannot be accessed from outside the class, however, they can be accessed in inherited classes.
Public: Public members are accessible from outside the class.
Private: Private members cannot be reached (or viewed) outside the class.
Similar questions