Computer Applications
Which of the following statements is the most appropriate for the private members?
- They are visible out of the class in which they are defined.
- They can be used in the sub-classes.
- They are only visible in the class in which they are declared.
- None of the above.
Java Classes
29 Likes
Answer
They are only visible in the class in which they are declared.
Reason — Private data members and member methods can only be used within the scope of a class.
Answered By
10 Likes
Related Questions
Find the access specifier which prohibits a class member from being used outside a class:
- Private
- Public
- Protected
- None
A class object is also known as:
- Identifier
- Instance variable
- Specifier
- Modifier
Which of the following keywords are used to control access to a class member?
- Default
- Abstraction
- Protected
- Interface
Which of the members can be accessed globally?
- Private
- Public
- Protected
- All of the above