Stack is a Linear Data Structure.Stack can be Implemented easily by using an array in Java .Every Stack has two Main Operations/Methods

a)Push-Used to Insert an Element to the Stack

b)Pop- Used to Remove an Element from the Stack


 void push(int item)  
  {  
    if(top==n)  
    {  
      System.out.println("STACK IS FULL");  
    }  
    else  
    {  
    a[top]=item;  
    top++;  
    }  
  }  
  void pop()  
  {  
    if(top==0)   
    {  
     System.out.println("STACK EMPTY");   
    }  
    else  
    {  
      top--;  
      out=a[top];  
    }
Get the Complete Code from http://c-madeeasy.blogspot.com/2011/...structure.html