Java Reference
In-Depth Information
7.
The output from this program is shown here:
8.
Here are some things to try on your own. Create a circular version of
DynQueue
.
Add a
reset( )
method to
ICharQ
, which resets the queue. Create a
static
method
that copies the contents of one type of queue into another.
Variables in Interfaces
As mentioned, variables can be declared in an interface, but they are implicitly
public
,
stat-
ic
, and
final
. At first glance, you might think that there would be very limited use for such
variables, but the opposite is true. Large programs typically make use of several constant
values that describe such things as array size, various limits, special values, and the like.
Since a large program is typically held in a number of separate source files, there needs to