Sorry, I just started coding and I'm trying to put an instance of a object into a stack and peek it but when I peek it, I think it's showing me the memory address of the stack item instead of the actual value. The dog class I'm using only one has one variable and it's name.
import java.util.Stack;
public class Driver {
public static void main(String[] args) {
Stack myStack = new Stack();
Dog dog1 = new Dog("jake");
myStack.push(dog1);
System.out.println(myStack.peek());
}
}
This is the output it gives me:
Dog@5eb5c224
I tried messing with the peek function and trying to place it into another variable of object Dog but I couldn't get anything to work.