Access Modifiers - Default
default (no modifier)
The default access modifier (no modifier) allows access only within the same package. It is more restrictive than protected but less restrictive than private. If no access modifier is specified, the class, method, or variable is considered to have default access.
DefaultExample.java
Main.java
If you try running the above, you'll notice a compilation error because Main.java is in the default package, while DefaultExample.java is in the example package. However, if we move Main.java into the example package, it will work:
ByteBrawl
0