The basic utility of Operand Stack are as follows:
- JVM uses operand stack as a work space like rough work. We can say for storing all the intermediate calculation’s result. Like we use a rough sheet to do our calculation.
- Operand stack can also be looked as organized array of words like local variable array. Then again there is a catch, this is not accessed by using index like local variable array does, rather it is accessed by some instructions that can push and pop values to and from operand stack and perform required operations.
This is the use of Operand Stack in JVM. To visualize it better, think of a stack and imagine push and pop operation. In the push and pop operation instead of number or string there are instructions. That's Operand Stack.