Skip to content
Advertisement

Not displaying elements from stack

So I have written this JAVA-program for stack and the problem is I cant display the elements using the display() method which I used in the code.

here is my Stack class.

JavaScript

here is the main method class

JavaScript

when I try to execute what is get is “Stack underflow” from the isempty() and nothing is displayed after that. Please help me where I need to correct this code.

Advertisement

Answer

fix methods push & display:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement