Hi I'm trying to write a toString() method for a generic LinkedStack but I'm having trouble
My class has two push methods. One pushes elements of some type onto the stack. It takes in some generic element and pushes it onto the stack. The other method takes in some generic stack and pops all of its elements onto the current stack.
So I have something like
public LinkedStack<T> copyStack(){
//code goes here
}
To test my code I created a LinkedStack<String> object and pushed items onto it.
I then used some of the LinkedStack methods to modify and printed the final results
But instead of getting the items on the stack, I got pointers to memory address
I'm not sure how I would implement a toString() method to handle this.
Any help is appreciated.
Thanks