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.
3 Antworten
+ 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.
+ 2
you will get this if you worked with awt or swing...
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