Java Reference
In-Depth Information
3.
Changing
q
,
putloc
, and
getloc
from default access to private access has no effect on
a program that properly uses
Queue
. For example, it still works fine with the
QDemo
class from
Try This 5-2
.
However, it prevents the improper use of a
Queue
.
For example, the following types of statements are illegal:
4.
Now that
q
,
putloc
, and
getloc
are private, the
Queue
class strictly enforces the first-
in, first-out attribute of a queue.
Pass Objects to Methods