What will be main reason and benefit of using thread? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will be main reason and benefit of using thread?

I am confused and don't understand the benefit of using thread? can someone describe it with example? it would be helpful for beginners to understand java thread.

12th Jan 2017, 11:29 AM
Mostasim Billah
Mostasim Billah - avatar
3 Answers
+ 2
threads are usefull. suppose you are making an user interactive app then performing a action event should not disturb the graphics of the app. and the operation must be performed smoothly so we use threads.
12th Jan 2017, 3:00 PM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar
+ 2
you will get this if you worked with awt or swing...
12th Jan 2017, 3:01 PM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar
0
Threads enables us to execute two or more (depending how many cores your system has) parts of a program at really tge same time. Normally code runs sequentially. Which means following for time t t=0 obj1 runs t=1 obj2 runs t=3 obj1 runs t=4 obj2 runs With thread its like following t=0 obj1 runs obj2 runs (each on its own thread) t=1 obj1 runs obj2 runs
12th Jan 2017, 11:44 AM
Andreas K
Andreas K - avatar