Try This 6-2 Overloading the Queue Constructor

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 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 ...

Get Java, A Beginner's Guide, 5th Edition, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.