Gemini to the rescue:
Prompt:
If I run in two seperate threads two voids and in one of them the code breaks does the whole application stop working?
Response:
No, the application will not stop working. In Java, each thread runs independently and has its own isolated call stack. If an unhandled exception occurs and "breaks" the code in one thread,
only that specific thread will terminate. The other thread and the rest of your application will continue running normally.
The only exceptions to this rule are:
- If the thread throws a critical, system-wide error that crashes the entire JVM (such as an OutOfMemoryError).
- If your code catches the exception and explicitly terminates the program using System.exit().