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 In | Default | Public | Protected | Private |
---|---|---|---|---|
Same Class | Yes | Yes | Yes | Yes |
Same Package Subclass | Yes | Yes | Yes | No |
Same package non-subclass | Yes | Yes | Yes | No |
Different Package Subclass | No | Yes | Yes | No |
Different Package non-subclass | No | Yes | No | No |
1 comment:
Thanks. It helps understand the way APIs work.
Post a Comment