In case of recursion, exception occurs when we did not specify the end point of the loop. let us take an example for the looping concept either in java or in c#, we have to follow three steps...
1) initiation of the loop eg: i=0
2) increment/decrement the loop accordingly eg: i++ or i-- respectively
3) end point eg: i<10
so, exception occurs in that case if we start the loop at i=1 and following the condition i>0 ...it means the loop will not have a terminated point and it shows an error Stack overflow.
so, be ensure the loop follow the above steps...to overcome from the exception.Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator