|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectStack2
public class Stack2
Implementation of a stack as an array
Constructor Summary | |
---|---|
Stack2()
No argument constructor |
Method Summary | |
---|---|
boolean |
empty()
Method to check if the stack is empty |
static void |
main(java.lang.String[] args)
|
java.lang.Object |
peek()
Method to return the top element on the stack but not remove it. |
java.lang.Object |
pop()
Method to remove and return the top element on the stack |
void |
push(java.lang.Object element)
Method to add an element to the top of the stack |
int |
size()
Method to return the number of elements in the stack |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Stack2()
Method Detail |
---|
public void push(java.lang.Object element)
element
- the element to addpublic java.lang.Object peek()
public java.lang.Object pop()
public int size()
public boolean empty()
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |