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
About Question com.enthuware.ets.scjp.v6.2.523 :
Moderator: admin
-
- Posts: 1
- Joined: Sun Nov 09, 2014 5:52 pm
- Contact:
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.523 :
Looping doesnt cause Stack Overflow. Calling method inside a method repeatedly like inrecursion does.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: Bing [Bot] and 233 guests