JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label daemon. Show all posts
Showing posts with label daemon. Show all posts

Difference between Daemon Thread vs User Thread in Java with example?

1:01 AM
Difference between Daemon Thread vs User Thread in Java? A thread is used to perform parallel execution  in Jaa e.g. while rendering screen your program is also downloading the data from the internet in the background. There are two types of threads in Java, user thread and daemon thread, both of which can use to implement parallel processing in Java depending upon priority and importance of the task. The main difference between a user thread and a daemon thread is that your Java program will not finish execution until one of the user thread is live. JVM will wait for all active user threads to finish their execution before it shutdown itself. On the other hand, a daemon thread doesn't get that preference, JVM will exit and close the Java program even if there is a daemon thread running in the background. They are treated as low priority threads in Java, that's why they are more suitable for non-critical background jobs. In this article, we will learn some key difference be

.