O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8: Packages and Interfaces

1. Using the code from Try This 8-1, put the ICharQ interface and its three implementations into a package called qpack. Keeping the queue demonstration class IQDemo in the default package, show how to import and use the classes in qpack.

To put ICharQ and its implementations into the qpack package, you must separate each into its own file, make each implementation class public, and add this statement to the top of each file.

Image

Once this has been done, you can use qpack by adding this import statement to IQDemo.

2. What is a namespace? Why is it important that Java allows you to partition the namespace?

A namespace ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required