• Post Reply Bookmark Topic Watch Topic
  • New Topic

what type of exception is arithmetic exception?  RSS feed

 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i read that all exception of class RunTimeException, Error and their subclass are unchecked exception. but even being a subclass of RunTimeException, the ArithMaticException (thrown in a case like divide by 0) is a checked exception(this was told when i was giving moke test on javaranch). why is it so, or correct me if this is wrong.
 
Nadeem Awad
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sachin,
I believe that this is incorrect. The ArithmeticException is a RuntimeException, thus, an unchecked exception. You can see this if you make a quick sample.

Best regards,
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nadeem is correct. As the API indicates, ArithmeticException is a RuntimeException, so it's not checked.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!