T
- object of any typepublic class Stack<T>
extends java.lang.Object
Constructor and Description |
---|
Stack(int arrayLength)
constructor for Stack class
|
Modifier and Type | Method and Description |
---|---|
boolean |
isStackEmpty() |
T |
pop() |
void |
push(T element) |
private final T[] array
private int top
Stack(int arrayLength)
arrayLength
- the length of the stack which is to be builtpublic boolean isStackEmpty()
public void push(T element)
element
- adding a new element to stackpublic T pop() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if stack is empty, this exception will be thrown.