public class Stack
extends java.lang.Object
Constructor and Description |
---|
Stack()
This constructer method clear the stack.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
This method empty the stack.
|
boolean |
isEmpty()
This method checks the stack emptiness.
|
static void |
main(java.lang.String[] args)
This main method pushes and pops various inputs to test stack.
|
char |
pop()
This method returns the char on top of the stack and deletes char from stack.
|
void |
push(char c)
This method adds new char to the stack's top.
|
void |
push(java.lang.String s)
This method adds a string's chars separately into the stack.
|
java.lang.String |
toString()
This method returns the elements of stack as a string.
|
public void clear()
public boolean isEmpty()
public void push(char c)
c
- Char that will be added to stack.public void push(java.lang.String s)
s
- String that chars will be added into stack.public char pop()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- Unused.