SyntaxFix
Write A Post
Hire A Developer
Questions
You could convert it to an array and then print that out with Arrays.toString(Object[]):
Arrays.toString(Object[])
System.out.println(Arrays.toString(stack.toArray()));