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 Statement not reachable?? 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 "Statement not reachable??" Watch "Statement not reachable??" New topic

Statement not reachable??

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252

here why there is no error that statement is not reachable ...since the control returns out of main method??? c is not printed why there isn't any error??

Thanks & Regards<br /> <br />-Srikanth
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Try to put the return statement before the try catch block.. then you 'll get the error. When there is an exception ( checked or Unchecked ) thrown inside the try block then catch gets executed after that the S.O.P line will be rechable
[ October 14, 2005: Message edited by: Srinivasa Raghavan ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Liang Tong

Joined: Oct 14, 2005
Posts: 2
"return" means "terminate"
if there's no finally block in the structure "try-catch-finally"
the "return" in try block means "this method is over"
I agree. Here's the link:
subject: Statement not reachable??
It's not a secret anymore!