0% found this document useful (0 votes)
3 views8 pages

PDF File

Uploaded by

shop63p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

PDF File

Uploaded by

shop63p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Whot is

Threod7..........
A Thread is a very lig ht—weig hted process or
we can say the smallest part of the
process that allows a prog ram to operate
more effi ciently by running multiple tasks
simuItaneously.

lmporatance:
A Thread is a very light-
weighted process, or wemore con
progroi
soy to
the smallest port of the
effi by allows
cient thot
operate
process running
a
tasks
ly multiple
Start •
{) , run(
New )
Thread()
Extending the Thread
class
I S in T e d
I Using start() method
MyThread thread - new
MyThread();
thread.start();
Difference between run() and
start()
methods.
• run(): Calls the code in the
current
thread.
• start(): Starts a new
• Purpose: To prevent data
inconsistency
in multi-threaded applications.
“ • Synchronized Block and Method:
Allows only one thread to access a
resource at a time.
CODE
Il
synchronized void myMethod() (
code
1 to

rity.

You might also like