Computer Applications
A member variable declared with a private access specifier has visibility only in the …………… .
- Class
- Package
- Subclass
- All of these
Encapsulation & Inheritance in Java
3 Likes
Answer
Class
Reason — A member variable declared with a private access specifier has visibility only in the class in which it is declared.
Answered By
1 Like
Related Questions
Which of the following is an access specifier?
- public
- protected
- private
- All of these
A member variable declared with a public access specifier has visibility in …………… .
- Class
- Package
- Subclass
- All of these
A member variable declared with no access specifier has visibility in …………… .
- Class and package only
- Class, package and subclass only
- Class and subclass only
- Class only
An instance variable …………… .
- needs an instance to access it
- does not need an instance to access it
- can be accessed using the class name
- is declared with the static keyword