Exceptions in Java signal the occurrence of some unexpected error situation during execution. The exception handling mechanism is built around throw-catch paradigm. To throw an exception is to signal that an unexpected condition has occurred. To catch an exception is to take appropriate action to deal with the exception.
Several threads are executing in the JVM. Each thread has its own run time stack that is used to handle the execution of methods. Each element on the stack is called the activation record corresponds to a method call. The method with the activation record on the top of the stack is the one currently executing. When this method finishes execution, its record popped from the stack. The methods on the stack are said to be active as their execution has not completed. At any given time the active methods on the run time stack comprise what is called the stack trace of the thread's execution.
If the exception is not caught by any active methods, it is dealt with the main threads default exception handler. The default exception handler usually prints the name of the exception with an explanatory message followed by a printout of the stack trace at the time the exception was thrown. Remember, if an exception is thrown while evaluating the left hand side operand of a binary expression then the right hand operand will not be evaluated.
No comments:
Post a Comment