Question: PLEASE I NEED THE ANSWER NOW !! how what is output by the following segment of code: ArrayStack stack = new ArrayStack(); int x, y;
PLEASE I NEED THE ANSWER NOW !!
how what is output by the following segment of code:
ArrayStack stack = new ArrayStack(); int x, y; x = 5; y = 1; stack.push(6); stack.push(x); stack.push(x + 2); y = stack.top(); stack.pop(); stack.push(x + y); stack.push(y - 1); stack.push(7); x = stack.top(); stack.pop(); System.out.println("x = " + x); System.out.println("y = " + y); while (!stack.isEmptyStack()) { System.out.print(stack.top() + " "); stack.pop(); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
