The Default Package
When your classes don't have a package declaration, we say those are in the "default package."
// No package declaration means default package
public class Elf {
}
Classes in the default package cannot be imported by classes in named packages, regardless of if those classes are public.
package villager;
public class Villager {
// No way to reference Elf directly,
// even if Elf is public
}
Because of this restriction1 you will mostly use the default package when you are feeling lazy or are making a smaller program.
1
And more to come!