This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes throwing exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "throwing exception" Watch "throwing exception" New topic

throwing exception

Nasir Munir

Joined: May 31, 2002
Posts: 22
I want to throw an exception from if block which is written in a try block. If there is an exception I want it to be handled in the catch block. If I use throw new Exception() in the "if" statement, will it go to the catch block defined as catch(Exception ex).
Can I get some help here ? thanks.

pseudo code:
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
The easiest way to find the answer is to try it. Write some code and see what happens. Experimentation is a great way to learn.

Nasir Munir

Joined: May 31, 2002
Posts: 22
thanks for a good suggestion
It worked !!!
I agree. Here's the link:
subject: throwing exception
jQuery in Action, 3rd edition