Not all modifiers can be applied to all features.
Top-level classes may not be protected.
Methods may not be transient.
Static can apply it to free-floating blocks of code.
All Possible Combinations of Features and Modifiers
| Modifier | Class | Variable | Method | Constructor | Code Block |
|---|---|---|---|---|---|
| public | yes | yes | yes | yes | no |
| protected | no | yes | yes | yes | no |
| empty accessor | yes | yes | yes | yes | yes |
| private | no | yes | yes | yes | no |
| final | yes | yes | yes | no | no |
| abstract | yes | no | yes | no | no |
| static | no | yes | yes | no | yes |
| native | no | no | yes | no | no |
| transient | no | yes | no | no | no |
| volatile | no | yes | no | no | no |
| synchronized | no | no | yes | no | yes |
java2s.com | | Contact Us | Privacy Policy |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |