The Java programming language provides a mechanism known as exceptions (in the glossary) to help programs report and handle errors. When an error occurs, the program throws an exception. What does this mean? It means that the normal flow of the program is interrupted and that the runtime environment attempts to find an exception handlerâ€a block of code that can handle a particular type of error. The exception handler can attempt to recover from the error or, if it determines that the error is unrecoverable, provide a gentle exit from the program.

Here's the general form of these statements:

try {
statement(s)
} catch (exceptiontype name) {
statement(s)
} finally {
statement(s)
}

Recommended Answers

I'm not sure if you're asking a question, or providing a helpful tip. Also, you mention "Java" but posting in the JavaScript forum.

Please provide a bit more explanation of your intent so we can either help you, or move your post to the correct forum.

Jump to Post

All 2 Replies

I'm not sure if you're asking a question, or providing a helpful tip. Also, you mention "Java" but posting in the JavaScript forum.

Please provide a bit more explanation of your intent so we can either help you, or move your post to the correct forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.