Java Reference
In-Depth Information
is the following fragment correct?
No; a
private
member cannot be accessed outside of its class.
precede
likened to a stack of plates. The first plate put on the table is the last plate used.
Create a stack class called
Stack
that can hold characters. Call the methods that ac-
cess the stack
push( )
and
pop( )
. Allow the user to specify the size of the stack when
it is created. Keep all other members of the
Stack
class private. (Hint: You can use
the
Queue
class as a model; just change the way that the data is accessed.)