Welcome to the Ranch. There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
I believe the first situation is a special case, handled differently by the compiler so you can conditionally compile code based on a static boolean member. i.e. you can use this first form to turn a block of code on or off based on a boolean constant. The same special case doesn't apply to the "while" block.
Ajay, Please revisit the things that Ernest has said.None of the statements in the conditional block(if) and loop(while) will be reached ever,but for if it is a exceptional case,so compiler will not complain with the if(true)'s block. [ January 09, 2007: Message edited by: Sanjeev Kumar Singh ]
~Sanjeev Singh<br />SCJP 1.5
Joined: Dec 13, 2006
for if it is a exception case,so compiler will not complain with the if block.
asker didn't clarify that, I am trying to get this clarification from the asker whether my understanding is correct. I never said Ernest was incorrect.
Joined: Nov 01, 2006
Ajay I think you are right means you understood the right things.Any way there is not as such exception case as I wrote,I modified my last post for the same.
Joined: Jan 09, 2007
Thanks for the responses. I mentioned 'Unreachable exception' in my posting. Actually I meant 'Unreachable code' compile time error. Sorry.