Advertisements
Advertisements
Question
Explain any two types of access specifiers.
Short Answer
Solution
- Public: Accessible from all classrooms.
- Private: Only available within the class in which it is declared.
- Protected: Classes and their inherited subclasses can access them.
- When no access specifier is given, the default access is limited to classes inside the same package.
shaalaa.com
Notes
Students should refer to the answer according to their questions.
Is there an error in this question or solution?
Chapter 6: Class as the Basis of all Computation (Objects and Classes) - EXERCISES [Page 384]