Questions and Answers
Which of the following is an advantage of exception handling in Java?
It categorizes exceptions into different types.
What happens if a method throws an exception and it is not handled immediately?
The exception is propagated to the caller of that method.
What is the purpose of separating normal code from exception handling code in Java?
To avoid abnormal termination of the program.
Why is it recommended to handle exceptions with specific Exception classes instead of handling them with the Exception root class?
Signup and view all the answers
What happens if an exception is thrown and no appropriate exception handler is found?
Signup and view all the answers
Which of the following is NOT a way to handle exceptions in Java?
Signup and view all the answers
What is the purpose of the 'throws' clause in a method declaration?
Signup and view all the answers
Which of the following is true about try-catch blocks in Java?
Signup and view all the answers