Skip to content
Sharp

Core Java · interview question

What does the 'protected' keyword allow in Java?

Multiple choiceEasychapter-3-curatedpremiumcore-javacode-reading-and-state-safety
Choose one answer
Answer and explanation

Correct answer

C. Access within the same package and subclasses

Why

The 'protected' keyword allows access to the field or method from subclasses and other classes in the same package, promoting controlled visibility.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →