Which Java access modifier allows visibility only within the same class?
- A. public
- B. private ✓
- C. protected
- D. default
Correct answer
B. private
Explanation
Private members are accessible only within the class where they are declared.
B. private
Private members are accessible only within the class where they are declared.