| Author |
Exception
|
Mauro Trevigno
Greenhorn
Joined: Aug 27, 2012
Posts: 18
|
|
Hi guys,
Im catching the exception and I want to print a more specific exception, its this possible?
Because if i fo to java.lang.Exception, we have a lot of subclasses:
ex.
AclNotFoundException, ActivationException, AlreadyBoundException, ApplicationException, AWTException, BackingStoreException, BadLocationException, CertificateException.
Thanks.
Regards,
-M
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Im catching the exception and I want to print a more specific exception, its this possible?
Yes. If no exception class from the API suits your needs, you can make your own class by extending java.lang.Exception and throw an instance of it.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
Mauro Trevigno wrote:Im catching the exception and I want to print a more specific exception, its this possible?
It depends what you mean by that. Your print statement will print whatever the exception really is, regardless of what you catch it as.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Exception
|
|
|