+ 2

Threads in java

hi friends, could you please give me some cases or examples where we must use threads.

5th Dec 2016, 8:01 PM
JINA DIAM
JINA DIAM - avatar
2 ответов
+ 6
Java is a multi-threaded programming language which means we can develop multi-threaded program using Java. A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs. By definition, multitasking is when multiple processes share common processing resources such as a CPU. Multi-threading extends the idea of multitasking into applications where you can subdivide specific operations within a single application into individual threads. Each of the threads can run in parallel. The OS divides processing time not only among different applications, but also among each thread within an application. Multi-threading enables you to write in a way where multiple activities can proceed concurrently in the same program.
5th Dec 2016, 8:04 PM
( ͡° ͜ʖ ͡°)
+ 6
Typically you will use it with Swing or JavaFX, it's successor, so as to keep your UI responsive while doing time consuming tasks like network requests or heavy computation.
5th Dec 2016, 8:30 PM
Jean-Hugues de Raigniac
Jean-Hugues de Raigniac - avatar