Originally posted by Namaste Sathi: hi all, could you please tell me what are differences between Stack and Heap in Java? are they created in RAM or Hard Drive? thanks.
The Heap is where all object instances are stored and Stack are where all method locals are stored. RAM or Hard Drive depends on the OS. Generally speaking it would be RAM, but since most modern OSs use virtual memory, some could be temporarily stored on the Hard Drive.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
It's weird that we cook bacon and bake cookies. Eat this tiny ad: