public class Stack
extends java.lang.Object
Constructor and Description |
---|
Stack()
Creates an empty stack.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Returns whether the stack is empty.
|
void |
pop()
The upmost object is removed (popped) from the stack.
|
java.lang.Object |
popAndTop()
Removes (pops) the upmost object from the stack and returns the new upmost object.
|
void |
push(java.lang.Object object)
Puts (pushes) a new object on the top of the stack.
|
java.lang.Object |
top()
Returns the upmost object of the stack.
|
java.lang.Object |
topAndPop()
Removes (pops) the upmost object from the stack and returns it.
|
public boolean isEmpty()
public void push(java.lang.Object object)
object
- any object.public void pop()
public java.lang.Object top()
public java.lang.Object popAndTop()
public java.lang.Object topAndPop()