0

I have a main thread in android and it has spawned a child thread(an intentService but it doesn't really matter its just a thread). Lets say the child thread gets a uncaught null pointer exception then my question is does the main thread die or only the child thread ? can the process continue ?

j2emanue
  • 56,631
  • 57
  • 264
  • 415

1 Answers1

1

If a thread exits due to an error, the JVM will continue execution as long as there exists other non-daemon threads. Daemon threads are like normal threads, but do not keep the JVM alive if there only daemon threads still alive. The JVM usually keeps a lot of daemon threads around, including the GC and finalizer threads, to do maintenance and process signals from the OS.

Smith_61
  • 2,050
  • 9
  • 12