This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "reachable statement" Watch "reachable statement" New topic
Author

reachable statement

Stary Kapec
Ranch Hand

Joined: Dec 04, 2005
Posts: 81


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

Joined: Feb 24, 2006
Posts: 6661
    
    5

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
hi

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)
 
Don't get me started about those stupid light bulbs.
 
subject: reachable statement
 
Similar Threads
Not reachable code
Statement not reachable
Unreachable statement
Re checking the connection
Difference between the way of throwing exception.