How to Initialize an Empty Stack

I'm having an issue with one of my homework questions. I guess I'm just confused about the purpose of the StringQueue() inside the StringQueue class.

public class StringQueue {
    //You may NOT add any more fields to this class.
    private Stack<String> stack1;
    private Stack<String> stack2;

    // Initializes an empty queue
    public StringQueue() {
        ** Need Some Code Here **

    }

I apologize if this seems too much like a 'Do my homework for me' question, but I am at a total loss with this function. Any advice is appreciated.



Read more here: https://stackoverflow.com/questions/64417841/how-to-initialize-an-empty-stack

Content Attribution

This content was originally published by Code Boy at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: