What kind of thread is the Garbage collector thread?

It is a daemon thread.

A daemon thread is a thread that is considered doing some tasks in the background like handling requests or various chronjobs that can exist in an application.
When your program only have damon threads remaining it will exit. That's because usually these threads work together with normal threads and provide background handling of events.
You can specify that a Thread is a demon one by using setDaemon method, they usually don't exit, neither they are interrupted.. they just stop when application stops.

In Java, any thread can be a Daemon thread. Daemon threads are like a service providers for other threads or objects running in the same process as the daemon thread. Daemon threads are used for background supporting tasks and are only needed while normal threads are executing. If normal threads are not running and remaining threads are daemon threads then the interpreter exits.
   setDaemon(true/false) ? This method is used to specify that a thread is daemon thread.

  public boolean isDaemon() ? This method is used to determine the thread is daemon thread or not.

Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email