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 could please answer this Q 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 "could please answer this Q" Watch "could please answer this Q" New topic

could please answer this Q

zaghal mohd
Ranch Hand

Joined: Jun 27, 2002
Posts: 43
there is any conditions to use try{} catch{}
or throws and what is the differnt betwen them

Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
I'm confused. Your question is very vague. Is there something, in particular, that you're confused about concerning exception handling? Perhaps, if you provide some more details, we can help more. For now, all I can do is point you to some articles concerning exception handling.
Exceptions in Java
Designing with Exceptions
I hope that helps a little,

SCJP Tipline, etc.
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
If you are calling a method that throws a checked exception, the calling method must either deal with the checked exception with a try-catch block or rethrow it by explicitly declaring it in its throws clause.
zaghal mohd
Ranch Hand

Joined: Jun 27, 2002
Posts: 43
What I mean it concerning exception we have to way that we can throw exceptions one must deal with (try catch block) and other using (throw) clause there is any conditions that give me choice to chose any one or it open door to use any one
Snigdha Solanki
Ranch Hand

Joined: Sep 07, 2000
Posts: 128
If your program throws a checked exception then either you have to use try/catch block or you can use throws keyword in the method defintion.
I guess you can use throws in cases where you just want to ignore the exception. In the other approach you can catch the exception and take any relevant action.

Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform
I agree. Here's the link:
subject: could please answer this Q
It's not a secret anymore!