public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
Stack<Integer> stack = new Stack<Integer>();
stack.push(3);
stack.push(2);
stack.push(4);
Stack<Integer> stack2 = new Stack<Integer>();
while (!stack.empty()) {
stack2.push(stack.pop());
}
while (!stack2.isEmpty()) {
list.add(stack2.pop());
}
for (int i : list) {
System.out.println(i);
}
}
ArrayList<Integer> list = new ArrayList<Integer>();
Stack<Integer> stack = new Stack<Integer>();
stack.push(3);
stack.push(2);
stack.push(4);
Stack<Integer> stack2 = new Stack<Integer>();
while (!stack.empty()) {
stack2.push(stack.pop());
}
while (!stack2.isEmpty()) {
list.add(stack2.pop());
}
for (int i : list) {
System.out.println(i);
}
}