This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with TensorFlow and have Chris A. Mattmann on-line!
See this thread for details.
Win a copy of Machine Learning with TensorFlow this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

ArithmeticException

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ArithemeticException is checked exception. True/false.
I thogut the True is the answer. but it is given false. any one pls explain. all runtime exception is not checked exception- pls explain.
 
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...,

  1. Checked Exception represent conditions that, although exceptional, can reasonably be expected to occur. Making this exception checked, documents the existence of the exception and ensures that the caller of a method deals with the exception in some way.
  2. Unchecked Exception represent conditions that, generally speaking, reflect errors in your program logic and cannot be reasonably recovered from at run time. for example, the ArithemeticException thrown when you devided a number with integer zero, tells you that your program calculated incorrectly. These are error should be corrected in the program code.

  3. hope that helps
    stevie
 
Balaguru Janarthanan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, Stevie, I need not handle this type of runtime errors. Am i right?
 
Stevie Kaligis
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RuntimeException and Error are the only exceptions you do not need to list in your throws clauses. They are ubiquitous, and every method can potentially throw them. This is why they are unchecked by the compiler.
Note :
The contract defined by throws clause is strictly enforced, you can throw a type of checked exception that has been declared in the throws clause. Throwing any other type of checked exception is invalid.
If a method has no throws clause, it does not mean that any exception can be thrown, it means No checked exceptions can be throw.
regard's
stevie
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yes , we donot need to handle runtime exceptions.
Anyway , Is there some easy way to remember which exception classes are checked exceptions and which are RuntimeExceptions/unchecked exceptions.

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Unchecked Exceptions:ArithmeticException,NumberFormatException,NullPointerException
checked exceptions: IOException,FileNotFoundException,MalformedURLException,InterruptedException(most common exceptions)
jeena jose
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic