Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.523 :

Posted: Fri Nov 14, 2014 2:25 pm
by jwilde3
:lol: The following program will always terminate.

true or false.

Yes, I saw the possibility for an endless loop... But my logic consisted of... even if it's an endless loop, It will eventually Stack Overflow. So Yes(true), It will always terminate (eventually)....

Correct answer :

false : It is very possible It could get stuck in an endless loop.



Now that I think about it.... if it is just variables that are being incremented and only taking up x amount of space on 2 threads.... will a stack overflow ever happen? because there is enough memory to store 2 threads with a couple int's.. (I am assuming no, please correct me if im wrong)

now if each thread in an endless loop created an object or a new thread , thus taking memory and making a stack overflow occur, would the people that write this test consider that termination?

3rd test in 6 hours... my Java Mind is :shock:

Re: About Question com.enthuware.ets.scjp.v6.2.523 :

Posted: Fri Nov 14, 2014 5:22 pm
by admin
Looping doesnt cause Stack Overflow. Calling method inside a method repeatedly like inrecursion does.