Hi
I have simple doubt about infinte loop and recursive funtion with the StackOverflowError.
My question is why infinite loop will not cause StackOverFlowError whereas Recursive function will?
E.g in the
SCJP book i have found a below question and at first i thought one of the option will be StackOverflowError but it was wrong.
Could someone please explain this?
case 0 : {
for(int x=10;x>5;x++){
if(x>10000000000)x=10;
break;
}
}
the two closely related options for this are
1.StackOverflowError
2.Program Might hang without ever completing
this will surely cause infinte loop when the switch valus i 0 but why the option is just only 2 not include 1.