Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to classify an exception as checked or unchecked?

 
Ajay Xavier
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for every one who gave their veiws on my last query.(Throwing a null value from a method)

How to classify an exception as a checked one or unchecked one? To be more precise how do i decide the superclass (Exception or RuntimeException) of my custom exception?

Thanks,
Ajay.
 
Chetan Raju
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All exception classes that extend the RuntimeException class are said to be unchecked exceptions. This means the compiler doesn't check the RuntimeExceptions. So if you want to create a checked exception then extend your class with Exception class.

Also, the Error class and subclasses of Error are also unchecked by compiler.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic