**Why am I getting strange output in case of StackOverflowError ?**

```
public class Hello{  
    public static void main(String args[]){  
        System.out.println(new Exception().getStackTrace().length);  
        m1();  
    }  
    public static void m1(){  
        m2();  
    }  
    public static void m2(){  
        try{  
            m1();  
        }catch(StackOverflowError err){  
            System.out.println(err.getStackTrace().length);  
        }  
    }  
}  

Output (a)-
        1
        102410241024102410241024102410241024

Output (b) -
        1024

Output (c)-
        1
        1024   

```

When the above code executes I am getting Output (a).But when I am commenting first line of main method I am getting Output (b).

I should be getting Output (c) when I am executing the above code by keeping the first line in main method uncommented

Why is 1024 getting printed so many times in Output (a)?

I was trying to find out default stack size by raising StackOverflowError and purposely catching it.I printed stack size before calling m1 method from main method.