+ 4
What is Thread in Java?
I'm just beginer so I'm not sure about Thread.
3 Réponses
+ 5
A thread is a sub-program within a main program.
That is, threads provide a way of running blocks of code simultaneously.
Practical example
==============
*You can start a separate thread in your browser to download a file, while you continue browsing at the same time.
*You can start a new thread on Whatsapp to upload your statuses while you continue chatting with friends.
In a nutshell, threads enable you do multiple things at a time.
+ 2
Threads are a way to run more than one code at a time, for example, when a program reads data from slow hardware, it does not have to wait for the result of the operation, and can use this free time to compute the graphics.
The computer can do this by quickly exchanging tasks as needed.
eg do tasks a and b:
start(a) aaaa start(b) bb aaa b aa bbbb aaaaa b end(a) bbbbb end(b).
But programmer can see there is thread1 and thread2, both executes their-self codes in the same time.