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 Beginning Java and the fly likes core java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "core java" Watch "core java" New topic
Author

core java

vijay deivasigamani deivasigamani
Greenhorn

Joined: Apr 15, 2007
Posts: 3
Hi,

I have a doubt, can we return an exception to a method? if so give me an example.
Jim Hardin
Ranch Hand

Joined: Aug 02, 2006
Posts: 46
I think this question belongs in "Java >> Java in General (beginner)"
instead of "Products >> Struts". That said, if I understand your question, I think you're looking for:

See also Sun Exceptions Tutorial.
-Jim
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Yes, a method can return any type, also an Exception.

This:

returns an Exception, but it does not throw one. Output is
java.lang.Exception: Eeks !


Yours,
Bu.


all events occur in real time
vijay deivasigamani deivasigamani
Greenhorn

Joined: Apr 15, 2007
Posts: 3
Hi Burkhard Hassel , Jim Hardin

Thanks for your reply and cleared with the doubt.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: core java
 
It's not a secret anymore!