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

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article