(String args[])
| 2 | |
| 3 | public class StackJCF { |
| 4 | public static void main(String args[]) { |
| 5 | Stack<Integer> stack = new Stack<>(); |
| 6 | stack.push(1); |
| 7 | stack.push(2); |
| 8 | stack.push(3); |
| 9 | stack.push(4); |
| 10 | |
| 11 | while(!stack.isEmpty()) { |
| 12 | System.out.println(stack.peek()); |
| 13 | stack.pop(); |
| 14 | } |
| 15 | } |
| 16 | } |