← Quiz: Java Classes and Objects: all 10 questions
Quiz: Java Classes and Objects · Question 4 of 10
Which access modifier makes a field visible ONLY inside its own class?
Which access modifier makes a field visible ONLY inside its own class?
- A.public
- B.protected
- C.private
- D.default (no modifier)
Answer & explanation
Correct answer: private
private restricts access to the declaring class.
Can you get the rest right without peeking?
Take the timed Quiz: Java Classes and Objects quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →