Hi, You expect lot of question like this in certification Exam. If curly braces are not in while loop it executes only next line of the while loop. for example
if curly braces are not placed in above code it work like above. [ April 06, 2005: Message edited by: Raghu Shree ]
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
do while( i < 15 ) //always true System.out.println( "Ok" ) ; while( i < 1 );
isn't this result in infinite loop.
Joined: Jul 19, 2004
Indeed its an infinite loop and the jvm will go just running it forever. Well, about its being unreachable there is a JLS topic u can go thru it. unreachable Well, Its quite confusing and questions related to these topics usually dont come. Well i havent given the exam so i cant say u exactly whether such questions come or not. So i suggest u can just skip ths topic.