aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes unreachable statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "unreachable statement" Watch "unreachable statement" New topic
Author

unreachable statement

sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257

gives unreachable statement at 6. is it bcos line 7 is not reached?
Thanks


Sunita<br />SCJP 1.4
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
The syntax for a while statement is: while(boolean_condition) statement;
If, as in your example, boolean_condition is false, then statement is unreachable.
Beacause a block which is { statement; ... } IS a statement the message that line 6 is unreachable is correct.
Sort of...
-Barry


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
Thanks Barry
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Also check out JLS 14.20 Unreachable Statements


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unreachable statement