Access Control
Less than 1 minuteNoteLanguageJava
Package
- A collection of similar classes, interfaces, or other packages
package,import- Create a library and import it
- Extract the package to
.jar(Java ARchive) file in the project structure - Import the
.jarfile into the new project libraries in the project structure
- Extract the package to
Scope
Naming Convention
- Reversed url
Access control
At the top level: public or package-private (no explicit modifiers)
At the member level: public, private, protected, or package-private
A class declared with
publicis visible to all classes everywhere; A class with no modifier is visible only within its packageModifier Class Package Subclass outside the package World publicY Y Y Y protectedY Y Y N no modifier Y Y N N privateY N N N
