Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.util.Stack;
- public class Test
- {
- public static void showpush(Stack<Integer> st,int a)
- {
- st.push(a);
- System.out.println("push("+a+")");
- System.out.println("stack : "+st);
- }
- public static void showpop(Stack<Integer> st)
- {
- System.out.println("Pop ->");
- Integer a = st.pop();
- System.out.println(a);
- System.out.println("stack: "+st);
- }
- public static void main(String[] args)
- {
- Stack<Integer> st = new Stack<Integer>();
- System.out.println("stack : "+st);
- showpush(st,42);
- showpush(st,66);
- showpush(st,99);
- showpop(st);
- showpop(st);
- showpop(st);
- }
- }
Add Comment
Please, Sign In to add comment