Not sure, but I thought all fields which are objects (the three Strings, and the one "example") are referred to as references on the heap. Not sure, but I think the int is a value on the heap.
The heap and stack both usually, as far as I know, live in RAM, but if there is overloading of RAM there may be paging to the hard drive. That is an OS problem, which you don't have to worry about, though buying a bit of extra RAM may be useful.
Your example given has however got an infinite recursion in, which will fill up both your heap and your stack, only it is likely that you will run out of stack space before you run out of heap space!
Joined: May 12, 2008
lol is true, but i wrote that example looking for answers, and i didn't think about compiling