9
Difference between protected and default/package access in Java
source link: https://marco.dev/java-access-modifiers
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Protected vs default access control
Differences between the protected and the default/package-private access.
Quick overview, this is a typical interview question.
In short:
- the protected access has a modifier (keyword): protected
- the default access doesn’t have any modifier.
- the default access doesn’t allow access outside of the package
The complete details (Java Language Specification 11)
Author
Marco Molteni
Marco Molteni Blog
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK