Assume that a stack has been declared and instantiated with the ArrayDeque class. Show the output produced

Question:

Assume that a stack has been declared and instantiated with the ArrayDeque class. Show the output produced by the following code fragment:

stack.push('Z'); stack.push('Y'); System.out.println(stack.peek()); stack.push('X');

You should be able to do this by just thinking about it, but feel free to complete and run a program to check your answer.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: