import java.util.ArrayDeque; import java.util.Deque; public class NewClass { public static void main(String[] args){ Deque<String> stack = new ArrayDeque<>(); stack.push("One"); stack.push("Two"); stack.push("Three"); int size = stack.size() -1; while(size >= 0){ System.out.println(stack.pop()); } } }