import java.util.*;
public class StackDemo
{
public static void main(String args[])
{
//creating a Stack
Stack<Object> stack = new Stack<Object>();
//find the size of element
System.out.println("Initial size of stack: "+stack.size());
System.out.println("Stack is empty: "+stack.empty());
//adding the element
for(char i = 65; i<75; i++)
{
stack.push(i);
}
System.out.println("Stack elements are after adding: \n"+stack);
System.out.println("Size of stack after add: "+stack.size());
System.out.println("Stack is empty: "+stack.empty());
//peek element of Stack
System.out.println("Top element in stack: "+stack.peek());
//search the Stack element
System.out.println("Search the elemnt A: "+stack.search('A'));
System.out.println("Search the element N: "+stack.search('N'));
// remove the stack elements
for(char j = 70; j<75; j++)
{
stack.pop();
}
System.out.println("Stack elements are after deleting: "+stack);
}
}