Which method is used to create a daemon thread?

Answer:

setDaemon(boolean value) – Set it to “true” to make thread as a daemon thread.

Notes:

It is mandatory to call this method before thread start() method. All threads created by a programmers are user threads/normal threads unless you marked it as a daemon thread using the method setDaemon(boolean value).

Example: