Daemon Threads in Java

Daemon threads: Thread behavior is either Daemon or Non-Daemon. Daemon threads execute background logic of application. Daemon threads also called service-threads. Daemon threads are invisible threads. Every thread is by default Non daemon. Non daemon …

Java Multi Threaded – Execution time

Execution time of Multi threaded application: When we execute different logics from different threads, time consumption will decrease. Multi threaded application increase the stress on processor by utilizing efficiently.

Java Single Threaded – Execution time

Execution time of Single Threaded application: If the application contains only one thread, the execution becomes sequential. To understand the execution time of application, we use pre-defined method of System class. When only one thread …

join() method – Java Thread class

join(): join() is pre-defined method in Thread class. It is non static method hence we call on Thread object. Stop current thread execution until joined thread execution completed.

Multiple Custom Threads in Java

How can we execute different logics from different threads? We can create multiple thread objects for a single thread class. We can define only run() method in thread class. When we start multiple threads of …

Can we call run() method directly?

Can we call run() method directly? Yes allowed but the logic executes from the same thread only. Run() contains the logic that should execute parallel from independent memory. Start() method is pre-defined in Thread class. …

sleep() in java Thread class

Thread class sleep method document: Program Code: In single threaded, execution starts @ default thread and ends @ the same thread. In multi threaded, any thread can completes the execution while all the threads executing …

Thread life cycle in java

Multi threaded application: Define and execute a Custom thread along with Default thread. When multiple threads are executing, any thread can completes execution first. Application ends only when all the threads moved to dead state. …

Create Thread in java

Creating Thread: java.lang package providing class and interface to create Thread. java.lang.Thread class java.lang.Runnable interface We can extends from Thread class or Implementing from Runnable interface. We need to override run() method to place the …

Courses Enquiry Form