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 try-catch-block 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 "try-catch-block" Watch "try-catch-block" New topic


Moya Green
Ranch Hand

Joined: Jan 24, 2002
Posts: 49
I want to check these two concepts, Am I right?Pls help!
1)A catch block should always be related with a try block;
2)A finally cannot stand alone without a try block.
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
1. Yes, although a try block may have a finally block instead of a catch block.
2. Yes.
Moya Green
Ranch Hand

Joined: Jan 24, 2002
Posts: 49
Dear Anthony,
Thanks for your timely reply.
It is sorta covered in the JavaRanch Style Guide.
subject: try-catch-block
Similar Threads
will using try/catch reduce performance?????
Try an Finally Working Confusion
Illegal Argument Exception
help in exceptions
Unreachable statement