aspose file tools
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 Elasticsearch in Action this week in the Big Data 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 !!!
rocket mass heater kickstarter
subject: throwing exception