An Error indicates serious problems that a reasonable application should not try to catch. When an error is produced, does the program break off or continue running? Or it depends on what kinds of errors? For instance, when OutOfMemoryError is produced, what will it happen? Thanks.
An Error gets thrown like an Exception and can be caught like one. If the Error is not caught, the code that called your main method gets control and causes a stack trace to be printed. This will show you the type of Error, where it happened, and how you got there from your main method. You can also catch an Error and try to handle it. For instance, you might designate some objects for garbage collection by setting their references to null. However, you should then do as little as possible (write critical data, release locked database records) and rethrow the error. This will give you the stack trace and allow the operator to cleanly restart the application. Remember that your execution environment may be corrupted as a result of the Error in a way you can't repair.