This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes reachable statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "reachable statement" Watch "reachable statement" New topic

reachable statement

Stary Kapec
Ranch Hand

Joined: Dec 04, 2005
Posts: 81

Hi, why there is no compile error at line 1?
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

That wont qualify for an unreachable statement because the finally block always runs after the try block completes. Lets say for some reason your infinite loop fails after sometime because you did something like this...

The compiler thinks since the try might fail for some reason i am gonna let this guy get away with this.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Charith Fernando
Ranch Hand

Joined: Sep 12, 2005
Posts: 67

it doesnt give a compilation error saying that its not reachable because it is something to do with the logic of the program. compiler wont check whether a code is reachable by checking the logic of the program...

Charith I Fernando<br />SCJP5, SCWCD, SCBCD, BSc(Hons) IS<br />+94 773 263 222 (mobile)
I agree. Here's the link:
subject: reachable statement
jQuery in Action, 3rd edition