You are here:   HomeJava ProgrammingJava ArrayGetting Length of an Array in Java
by Dinesh Thakur Category: array

 

import java.util.*;

class JavaExampleStackOperation
  {
    public static void main(String args[])
     {
        Stack Stck = new Stack();
        try
          {
            Stck.push(new Integer(0));
            Stck.push(new Integer(1));
            Stck.push(new Integer(2));
            Stck.push(new Integer(3));
            Stck.push(new Integer(4));
            Stck.push(new Integer(5));
            Stck.push(new Integer(6));
            System.out.println((Integer) Stck.pop());
            System.out.println((Integer) Stck.pop());
            System.out.println((Integer) Stck.pop());
            System.out.println((Integer) Stck.pop());
            System.out.println((Integer) Stck.pop());
            System.out.println((Integer) Stck.pop());
            System.out.println((Integer) Stck.pop());
          }
            catch(EmptyStackException e1) {}
     }
  }
Stack Operation in Java Using Array Example