September 2011
Beginner
650 pages
15h 47m
English
Try This 6-2 Overloading the Queue Constructor
QDemo2.java
In this project you will enhance the Queue class by giving it two additional constructors. The first will construct a new queue from another queue. The second will construct a queue, giving it initial values. As you will see, adding these constructors enhances the usability of Queue substantially.
1. Create a file called QDemo2.java and copy the updated Queue class from Try This 6-1 into it.
2. First, add the following constructor, which constructs a queue from a queue.

Look closely at this constructor. It initializes putloc and getloc to the values contained in the ob parameter. It then ...
Read now
Unlock full access