Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- /* Stack demo */
- Stack<Integer> stack = new Stack<>();
- stack.push(2);
- stack.push(8);
- stack.push(5);
- System.out.println("Stack demo: ");
- System.out.println("peek: " + stack.peek());
- System.out.println(stack.pop());
- System.out.println(stack.pop());
- System.out.println(stack.pop());
- stack.push(10);
- System.out.println("stack size: " + stack.size());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement