Will a java exception terminate the whole java application?

后端 未结 5 2036
闹比i
闹比i 2021-02-04 10:19

I used to think that when an exception happened, the whole java application will be terminated. For example, I write a test function to test my idea.

public void         


        
5条回答
  •  -上瘾入骨i
    2021-02-04 10:38

    If an exception is not caught with catch, the thread in which the exception occurred will be terminated. If no non-daemon threads remain the JVM will terminate. That's the only way how an exception might terminate a JVM. If you catch an exception it will never cause a JVM termination.

提交回复
热议问题