What will happen if an exception is not caught by any catch block?

  • The exception will be automatically caught by the JVM.
  • The program will continue to execute normally.
  • The program will enter an infinite loop.
  • The program will terminate with an error.
In Java, if an exception is not caught by any catch block within the current method, it will propagate up the call stack, and if not caught anywhere, it will lead to program termination with an error message. This is essential for identifying and handling exceptional situations in a program.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *