Skip to content

Tag: stack

Where is the super reference in a Java instance method’s stack frame?

I read Bill Venner’s excellent Inside the Java Virtual Machine book, which, in Chapter 5 explores in detail, among other things, the composition of a JVM’s stack frame. (This chapter from the book also happens to be officially published here: https://www.artima.com/insidejvm/ed2/jvm8.html) Apart from this book I studied relatively much the runtime data areas of some JVM’s, especially their stack and

Stack in Java not being able to print in specific order

Currently I’m working on a project that is supposed to be a reverse word guessing game. This is how it should work: The use keeps guessing the word until it is fully spelled out. If the user guesses the letter correctly it is revealed if not it is still reveled as shown below ⚠️ Currently I have a stack containing

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. public class Stack { //members …

Is this a stack?

Is this code a stack? How I can make it better? This is my first one. Can i do this using ArrayList? I didn’t added the isEmpty() method. Answer Yes, it is. But you can add checking for overflow, underflow. And this will be better if you’ll try using collections.