File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Doubt" Watch "Doubt" New topic
Author

Doubt

Gemi P
Greenhorn

Joined: Oct 04, 2004
Posts: 3
what is the differece between exception and error
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Moving to the Java In General (Beginner) forum...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Error stop the execution of the program. You are not to be able to recover from Error using try-catch statement.
For example UnsatisfiedLinkError means that JVM couln't find native language definition of a method. Your program couldn't continue without these method.

The exception shows you that something goes wrong but you could recover the state of the program, the program could continue.


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
Actually, any exception can be caught but some exceptions are considered unlkely to be handled successfully by a try/catch statement.

All exceptions are subclasses of Throwable. Subclasses of Error, which extends Throwable, are hardware/software errors that are usually beyond the scope of application code. Similarly, subclasses of RuntimeException, which extends Exception, which in turn extends Throwable, represent software errors (like OutOfMemoryError) that would be hard to predict in advance well enough to handle.

This leaves all subclasses of Exception that are not also subclasses of RuntimeException. These are called checked exceptions and must always be either caught by a try/catch statement or explicitly passed to the calling method by a throws clause. Checked exceptions are considered sufficiently predictable and potentially correctable that the programmer should think about handling them and show his/her decision in the code.
[ October 04, 2004: Message edited by: Mike Gershman ]

Mike Gershman
SCJP 1.4, SCWCD in process
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Doubt