answersLogoWhite

0


Best Answer

A non-caught exception is propagated out of the local catch block into the next catch block, daisy chaining to the outermost catch block in the run-time library, where it will be handled by abending the program.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

The catch block simply gives you the opportunity to handle a thrown exception. The catch block itself does nothing other than to catch a specific exception when it is thrown. But once caught, it is up to the programmer to decide how it is handled by providing specific code to deal with the exception.

Remember that an exception is not an error unless it is unhandled, which effectively renders your program undefined. So its a good idea to include a general exception handler near the top of the call stack to report the exception and provide a graceful fallback. The alternative is to allow the operating system to handle the exception which inevitably results in your program terminating unexpectedly, which is never a good thing.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

When an exception is arise in a program, if it's not caught by any exception handler, than it'll be caught by default handler provided by run-time system. This default handler displays a string describing the exception,prints a stack trace from the point at which the exception occurred and terminates the program.

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

The exception will be passed up the call stack. If there is no handler on the call stack, the program will terminate with an unhandled exception error. This is why your main function must have a catch-all exception handler. If your program could throw, always assume it will throw.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

An uncaught exception results in the uncaughtException() method of the thread's ThreadGroup being invoked, which eventually results in the termination of the program in which it is thrown

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What happens when raised exception is not caught by catch block?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

When do you say an exception is handled?

There is no catch block that names either the class of exception that has been thrown or a class of exception that is a parent class of the one that has been thrown, then the exception is considered to be unhandled, in such condition the execution leaves the method directly as if no try has been executed


How do you get finally block in javascript to only execute if there are no errors are caught by catch block?

You might consider a construct like this: try { some code } catch (exception) { var err=1; } if (!err) { your finally block }


What is the use of catch block in java?

the catch block catches the exception from the try block to display a proper message about the exception. Answered by, SOORAJ.M.S


Define a catch block?

A Catch block is part of the exception handling mechanism in Java. It is used along with the try block. Ex: try { ... } catch (Exception e) { ... } The catch block is used to catch & handle the exception that gets thrown in the try block.


What is the use of try in java?

The try keyword is used in Java to handle problematic situations that are commonly known as "Exceptions" The try keyword is used in conjunction with the catch keyword. If any exception is thrown by code inside the try block, they will be caught and handled by the catch block. Ex: try { ... ... } catch (Exception e){ ... }


How many catch blocks can you use with one try block with example?

A try block can have multiple catch blocks, each handling a different type of exception. Be careful about the order of laying the exceptions. Using Exception at the top will catch everything that is derived from it, thereby missing the other specfic exception catches. And there can also be only one finally block.


How do you throw exception?

using throws class try, catch block we through the exception


Why it is not possible to refer an exception declaration with in try block?

Because the exception, like any other declared object that needs visibility outside the block, must have scope outside the try block.


How do you use try block in cpp?

A try statement is used in conjunction with one or more catch blocks to provide exception handling. If an exception is thrown by a try block, the corresponding catch block will handle the exception. If no catch block is provided for a particular exception, then a runtime error occurs instead. Try-catch statements are used to provide graceful resolutions to potential runtime errors.


Must a Catch block include an exception object variable?

Yes. Without an exception, the program would never know when to enter the catch block. Most compilers will give a syntax error if you do not include an exception.


Why finally block is used even though statements after catch block are executable with out enclosing them in finally block?

Code in the finally block is executed even if no exception is thrown. That is to say, it is a way to make sure that a second of code always executes regardless of the path taken to reach the end of the try-catch block. The code in the catch block is executed only if there is an exception caught; it is intended to handle the situation that threw the exception. As a trivial example, you might allocate memory, perform some transaction, save the data to a file, then close the file and deallocate memory. It would make sense to put the memory allocation, file allocation, and data processing inside the try block, so you can catch any exceptions, then handle the exceptions in the catch block, and finally deallocate the memory and close the file, if open, using a finally block (to ensure that all resources were released, regardless of the exception handling).


Why use catch keyword in java?

no, because catch is used to handle exceptions which are generated from try block