Question: Consider a presentation of StringStack where we have a PR Person wrapper class, StringStack, and a StringStackltem class representing the inner structure of the stack.



Consider a presentation of StringStack where we have a "PR Person" wrapper class, StringStack, and a StringStackltem class representing the inner structure of the stack. The StringStackltem class looks ike the following: class StringStackItem ( String data; // Top of the stack at this point StringStackItem rest; // Rest of the stack // Implementation of toString method found below And we have the following StringStack wrapper class: public class StringStack { private StringStackItem top; public StringStack() // Create an empty stack top null; public void push(String s) ( StringStackItem item -new StringStackItem); item.data-a item.rest-top; top - item // Select the correct implementation of toString method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
