Please help to understand why does the following code
public class HeapQn1 { /** * @param args */ public HeapQn1() { new HeapQn1(
Basically what you said is correct, the stack space runs out before the heap space does.