Java Threads
Java Threads
What is a Thread?
A sequential (or single-threaded) program is one that, when executed, has only one single flow of
control.
i.e., at any time instant, there is at most only one instruction (or statement or execution point) that is
being executed in the program.
A multi-threaded program is one that can have multiple flows of control when executed.
At some time instance, there may exist multiple instructions or execution points) that are being executed in
the program
Ex: in a Web browser we may do the following tasks at the same time:
1. scroll a page,
2. download an applet or image,
3. play sound,
4 print a page.
A thread is a single sequential flow of control within a program.
How to create a Thread