When you write a field or method with no access keyword, Java doesn't make it public or private — it gets a fourth, lesser-known level called package-private.
| Modifier | Keyword you write | Same class | Same package | Other package |
|---|---|---|---|---|
| public | public String name; |
✓ | ✓ | ✓ |
| protected | protected String name; |
✓ | ✓ | subclasses only |
| (default) | String name; — no keyword |
✓ | ✓ | ✕ |
| private | private String name; |
✓ | ✕ | ✕ |
Room, the package-private fields are off-limits from outside com.pluralsight.hotel.
private explicitly on every field, and public on every method that needs to be called from outside. Don't rely on the default — it makes your intent unclear and accidentally exposes data to anything in the same package. The workbook calls this out in its example: "In this course we will use access modifiers for all members and functions." The default exists, but you almost never want it on purpose.