Question: (java) Write an algorithm that displays all the characters in a stack in the order in which they were pushed onto the stack. After all
(java)
Write an algorithm that displays all the characters in a stack in the order in which they were pushed onto the stack. After all the characters are displayed, the stack should have the same contents as when you started. In your method, you can only use the stacks operation, and NO explicit index can be declared to locate the items in the stack. Also, write the main() function to test your algorithm.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
