Home arrow static arrow Java Programming [Archive] - Ending an Endless Loop
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Ending an Endless Loop
This topic has 2 replies on 1 page.

Posts:14
Registered: 2/19/04
Ending an Endless Loop  
Jun 16, 2004 10:45 AM



 
		while (! source.nextTokenIs('}'))		{			dec = new ClassMemberDeclaration();          			dec.compile(source);		}


basically this question is regarding the above loop. This is a while loop that is looking for curly braces
 (i.e. } ) 
. But if there are no curly braces of that kind in the file that i am reading then this while loop becomes an endless loop. hence is there any way of timing this method, and after certain time (say 20 seconds the while loop is aborted and a message is displayed saying that the closing curly brace was not found????

please ignore the body of the method as it was just put there so that you could understand what i was on about.

please do reply, thank you
best regards

alpha
 

Posts:3,534
Registered: 9/30/99
Re: Ending an Endless Loop  
Jun 16, 2004 10:58 AM (reply 1 of 2)



 
duplicate post
 

Posts:10,972
Registered: 10/23/03
Re: Ending an Endless Loop  
Jun 16, 2004 11:09 AM (reply 2 of 2)



 
Endless loop? See this thread: http://forum.java.sun.com/thread.jsp?forum=31&thread=531136&tstart=0&trange=15
 
This topic has 2 replies on 1 page.