Computer Applications
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
Encapsulation & Inheritance in Java
3 Likes
Answer
Class and package only
Reason — A member variable declared with no access specifier has visibility in the same class and other classes of the same package only.
Answered By
1 Like
Related Questions
A member variable declared with a public access specifier has visibility in …………… .
- Class
- Package
- Subclass
- All of these
A member variable declared with a private access specifier has visibility only in the …………… .
- Class
- Package
- Subclass
- All of these
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
A static variable …………… .
- is preceded by static keyword in the declaration
- is accessed via the class name
- is also known as a class variable
- All of the above