• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception

 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic