0% found this document useful (0 votes)
5 views

Java Threads

Uploaded by

Edgar Phiri
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Java Threads

Uploaded by

Edgar Phiri
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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

 By Implementing a Runnable Interface


 By Extending a Thread Class
Example

You might also like