jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Unreachable statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Unreachable statements" Watch "Unreachable statements" New topic

Unreachable statements

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442

The above code compiles & runs fine.
Shouldn't th above code give complier error that "Unreachable statement"?Co line 1 is never reached What are the scenarios when compiler throws unreachable statement error?Are these kind of questions ,where compiler gives error that"Unreachable statement" going to appear in the exam?

"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Vad Fogel
Ranch Hand

Joined: Aug 25, 2003
Posts: 504
Method m1() might throw an exception that would halt the program as opposed to having a straight statement like throw new Exception(); A call to a method throwing an exception shouldn't make a statement immediately after it unreachable. Don't forget, m1() can be overridden not to throw any exception.
I agree. Here's the link: http://aspose.com/file-tools
subject: Unreachable statements
It's not a secret anymore!