Why does does my stack overflow error occur after 518669 specifically?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-03-08T21:10:38Z Indexed on 2010/03/08 21:21 UTC
Read the original article Hit count: 449

I created a java program to count up toward infinity:

class up {

    public static void up (int n) {
        System.out.println (n) ;    
        up (n+1) ;
}

    public static void main (String[] arg) {
        up (1) ;

}
}

i didn't actually expect it to get there but the thing that i noticed that was a bit curious was that it stopped at the same number each time: 518669

what is the significance of this number? (or of this number +1 i suppose).

(also as a bit of an aside question, I've been told that the way i format my code is bad [indentation and such] what am i doing that isn't desirable?)

© Stack Overflow or respective owner

Related posts about stack-overflow

Related posts about numbers