This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "unreachable statement" Watch "unreachable statement" New topic

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?

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...

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

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

[Blog] [Blogroll] [My Reviews] My Linked In
I agree. Here's the link:
subject: unreachable statement
It's not a secret anymore!