Re: Question Regarding Error
The total amount of stuff on the stack exceeds that default value, so you get that error.
let consider the case: makeBricks(1000000, 1000, 1000100)
from line 4, it will call makeBricks(999999, 1000, 1000099) and makeBricks(1000000,999, 1000095)
inside they will both call another two makeBricks
then numbers of call will be 1+2^2
So, the class will call at least 2^1000times to reach one end makeBricks(?,0,?)
But it is not the final end of the program and the class will still go on and go on.......
therefore you better edit your program to reduce the number of the calling-class loop
This is only my view, so correct me if i am wrong
Re: Question Regarding Error
This is a great question that deserves further study. The (very) short answer is big numbers cause the method calls to recurse too deeply exceeding the size of the call stack. See StackOverflowError (Java Platform SE 7 ) for the official one-liner on this error.
The relationship between recursion and the call stack is well-described in Part I of this article: Data Structures: Recursion, Stacks, And Trees - Java Tutorials | Dream.In.Code.
There's recursion, and there's recursion. See Java Recursion with examples on the different types of recursion. Some programming languages perform tail recursion optimisation/elimination to prevent errors like this (see Tail Call Optimization) but unfortunately Java does not, nor does Python (see Neopythonic: Tail Recursion Elimination).
Finally, see Inspired by Actual Events: Diagnosing and Resolving StackOverflowError on the different ways in which StackOverflowError can occur.