aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exception types 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 "Exception types" Watch "Exception types" New topic
Author

Exception types

Andry Dub
Ranch Hand

Joined: Nov 06, 2007
Posts: 43
Hi!

Is there difference between exceptions typically thrown by JVM/Programmatically and Runtime/Checked exceptions?


Java is my love
mr Morena
Greenhorn

Joined: Jan 15, 2008
Posts: 6
Originally posted by Andry Dub:
Hi!

Is there difference between exceptions typically thrown by JVM/Programmatically and Runtime/Checked exceptions?


in java programing: you can catch runtime error with try/catch.

try{
badExpressions;
}catch(RuntimeException ex)
{

}

but any error by jvm,will stop your program and running fail.
indeed you can't catch jvm error(exception)!


SCJP 6.0
chris java
Greenhorn

Joined: Jan 15, 2008
Posts: 3
Hi!

Is there difference between exceptions typically thrown by JVM/Programmatically and Runtime/Checked exceptions?


A RuntimeException (and any subclass) is an unchecked exception, so it is not required to be caught. The default consequence of an unchecked exception is that a message will be sent to the console.

An Error (and any subclass) is also an unchecked exception, although I believe most Errors result in the JVM halting processing. Hence, there isn't much point in trying to catch an Error, becuase is is unlikely that the code could recover from it.

All other exceptions are checked exceptions. This means that code calling the method(s) that throw the exception must have a try/catch block.

This link might also help: http://java.sun.com/docs/books/tutorial/essential/exceptions/runtime.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception types