This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Throw in catch block Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Throw in catch block" Watch "Throw in catch block" New topic
Author

Throw in catch block

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 323

Hi All,

Could you please tell me when we can write throw statement in a catch block?


Regards,
Pramod


Thanks,
Pramod
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14952
    
  26

There's nothing special in a catch block that would restrict you from throwing exceptions in there - exactly the same rules apply as outside a catch block.

Is there something specific, or do you have some example code, to explain why you have this question?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
Have you checked out Aspose?
 
subject: Throw in catch block
 
It's not a secret anymore!