File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes  A method can return an Exception .is it correct? 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 " A method can return an Exception .is it correct?" Watch " A method can return an Exception .is it correct?" New topic
Author

A method can return an Exception .is it correct?

wei liu
Ranch Hand

Joined: Dec 06, 2001
Posts: 56
A method can return an Exception .is it correct?
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
ya why not ! A method can return any type of object or primitive type or none(void). An Exception is an object...so can be returned from the method provided the method prototype shd declare the required return type.
HTH
Rashmi
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

That's true; there's nothing about this compiler cares about:

But I'm pretty that's not the actual question; or if it is, that the learning point behind it is a rather obscure one.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
jQuery in Action, 2nd edition
 
subject: A method can return an Exception .is it correct?