Search Logic Blocks

Tuesday, October 20, 2020

Java: Access Modifiers

We already discuss about the classes and objects, and packages. We already have discussed also about all three access modifiers (public, private and protected) and their scopes in the classes and packages. Let's revise all the access modifiers and default modifier (means when there is no modifier specified) in the table below:


Visibility InDefaultPublicProtectedPrivate
Same ClassYesYesYesYes
Same Package SubclassYesYesYesNo
Same package non-subclassYesYesYesNo
Different Package SubclassNoYesYesNo
Different Package non-subclassNoYesNoNo

1 comment:

Chris said...

Thanks. It helps understand the way APIs work.