Java Reference
In-Depth Information
three changes. First,
Book
needs to be declared
public
. This makes
Book
visible outside
of
bookpack
. Second, its constructor must be made
public
, and finally, its
show( )
method
needs to be
public
. This allows them to be visible outside of
bookpack
, too. Thus, to make
Book
usable by other packages, it must be recoded as shown here:
To use
Book
from another package, either you must use the
import
statement described
in the next section, or you must fully qualify its name to include its full package specifica-
tion. For example, here is a class called
UseBook
, which is contained in the
bookpackext
package. It fully qualifies
Book
in order to use it.