File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Head First Android this week in the Android 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)
jQuery in Action, 3rd edition
subject: reachable statement
It's not a secret anymore!