concept public access in category java

This is an excerpt from Manning's book Java SE 11 Programmer I Certification Guide.
This is the least restrictive access modifier. Classes and interfaces (and their members) defined using the public access modifier are accessible across all packages, from derived to unrelated classes.
To understand the public access modifier, let’s define the class Book as a public class and add a public instance variable (isbn) and a public method (printBook) to it. Figure 9.3 shows the UML notation (the sign + is used to show members with the public access in a UML).
Figure 9.3 Understanding the public access modifier
![]()
The public access modifier is the least restrictive access modifier. Classes and interfaces defined using the public access modifier are accessible to related and unrelated classes outside the package in which they’re defined.

This is an excerpt from Manning's book OCA Java SE 8 Programmer I Certification Guide.
Explanation: The code submitted by Paul is incorrect because when the class Curtain is defined with the public access modifier, it will be accessible outside the package building.
The access modifiers control the accessibility of your class and its members outside the class and package. Java defines four access levels: public, protected, default, and private.