aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes ArithmeticException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "ArithmeticException" Watch "ArithmeticException" New topic
Author

ArithmeticException

Balaguru Janarthanan
Ranch Hand

Joined: Nov 01, 2000
Posts: 37
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.
Stevie Kaligis
Ranch Hand

Joined: Feb 04, 2001
Posts: 400
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

Joined: Nov 01, 2000
Posts: 37
So, Stevie, I need not handle this type of runtime errors. Am i right?
Stevie Kaligis
Ranch Hand

Joined: Feb 04, 2001
Posts: 400
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
Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327

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.

jeena jose
Ranch Hand

Joined: May 06, 2001
Posts: 69
hi,
Unchecked Exceptions:ArithmeticException,NumberFormatException,NullPointerException
checked exceptions: IOException,FileNotFoundException,MalformedURLException,InterruptedException(most common exceptions)
jeena jose
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArithmeticException