SlideShare a Scribd company logo
SNS COLLEGE OF TECHNOLOGY
(An Autonomous Institutions)
19CST102 - OBJECT ORIENTED PROGRAMMING
I YEAR / II SEMESTER
UNIT IV – MULTITHREADING IN JAVA
TOPIC : INTER THREAD COMMUNICATION
Presented by:
Vishnnu K.S
(713522CS176)
Vilashini.V
(713522CS172)
Guided by :
Mr.Selvakumar. N
AP/CSE
Java Threads
• Threads allows a program to operate more efficiently by doing
multiple things at the same time.
• Threads can be used to perform complicated tasks in the
background without interrupting the main program.
Inter-thread Communication in Java
• Inter thread communication is all about allowing threads to
communicate with each other.
• It is implemented by following methods of Object class:
• Wait()
• Notify()
• NotifyAll()
Wait() method
• The wait() method causes current thread to release the lock and
wait until either another thread invokes the notify() method or the
notifyAll() method for this object,or a specified amount of time
has elapsed.
• The current thread must own this objects monitor,so it must be
called from the synchronized method only otherwise it will throw
exception.
Notify() method
• The notify() method wakes up a single thread that is waiting on this
object’s monitor.
• If any threads are waiting on this object,one of them is choosen to be
awakened.
Syntax:
Public final void notify()
NotifyAll() method
• Wakes up all threads that are waiting on this object’s
monitor.
Syntax:
Public final void notifyAll()
Understanding the process of inter-thread communication
• The point to point explanation of the above diagram is as follows:
• Threads enter to acquire lock.
• Lock is acquired by on thread.
• Now thread goes to waiting state if you call wait() method on the object.
Otherwise it releases the lock and exits.
• If you call notify() or notify All() method, thread moves to the notified state
(runnable state).
• Now thread is available to acquire lock.
• After completion of the task, thread releases the lock and exits the monitor
state of the object.
Understanding the process of inter-thread
communication
Difference between wait and sleep
wait() sleep()
The wait() method releases the
lock.
The sleep() method doesn't release
the lock.
It is a method of Object class It is a method of Thread class
It is the non-static method It is the static method
It should be notified by notify() or
notifyAll() methods
After the specified amount of time,
sleep is completed.
Program
Class Customer
{
Int amount=10000;
Synchronized void withdraw(int amount){
System.out.println(“going to withdraw….”);
If(this.amount<amount){
System.out.println(“less balance;Waiting for
deposit….”);
}
This.amount-=amount;
System.out.println(“withdraw completed….”);
}
Synchronized void deposit(int amount){
System.out.println(“going to deposit….”);
This.amount+=amount;
System.out.println(“deposit completed…”);
Notify();
}
}
Class Test{
Public staic void main(String args[]){
New Thread(){
Public void run(){c.withdraw(15000);}
}.start();
New Thread(){
Public void run(){c.deposit(10000);}
}.start();
}}
OUTPUT
going to withdraw….
less balance;waiting for deposit…..
going to deposit…..
deposit completed….
withdraw completed
Thank you

More Related Content

What's hot

Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
Srajan Shukla
 
Super Keyword in Java.pptx
Super Keyword in Java.pptxSuper Keyword in Java.pptx
Super Keyword in Java.pptx
KrutikaWankhade1
 
Java Multithreading and Concurrency
Java Multithreading and ConcurrencyJava Multithreading and Concurrency
Java Multithreading and Concurrency
Rajesh Ananda Kumar
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
Munazza-Mah-Jabeen
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)
Fahad Golra
 
Android Thread
Android ThreadAndroid Thread
Android Thread
Charile Tsai
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack
LavanyaJ28
 
Java method
Java methodJava method
Java method
sunilchute1
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
ARAFAT ISLAM
 
Oops in Java
Oops in JavaOops in Java
Oops in Java
malathip12
 
Basic of Multithreading in JAva
Basic of Multithreading in JAvaBasic of Multithreading in JAva
Basic of Multithreading in JAva
suraj pandey
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
Nilesh Dalvi
 
Advance ROP Attacks
Advance ROP AttacksAdvance ROP Attacks
input/ output in java
input/ output  in javainput/ output  in java
input/ output in java
sharma230399
 
Java threads
Java threadsJava threads
Java threads
Prabhakaran V M
 
Java threading
Java threadingJava threading
Java threading
Chinh Ngo Nguyen
 

What's hot (20)

Control statement-Selective
Control statement-SelectiveControl statement-Selective
Control statement-Selective
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
 
Super Keyword in Java.pptx
Super Keyword in Java.pptxSuper Keyword in Java.pptx
Super Keyword in Java.pptx
 
Java Multithreading and Concurrency
Java Multithreading and ConcurrencyJava Multithreading and Concurrency
Java Multithreading and Concurrency
 
javathreads
javathreadsjavathreads
javathreads
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)
 
Android Thread
Android ThreadAndroid Thread
Android Thread
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack
 
Java method
Java methodJava method
Java method
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Oops in Java
Oops in JavaOops in Java
Oops in Java
 
Basic of Multithreading in JAva
Basic of Multithreading in JAvaBasic of Multithreading in JAva
Basic of Multithreading in JAva
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
Advance ROP Attacks
Advance ROP AttacksAdvance ROP Attacks
Advance ROP Attacks
 
input/ output in java
input/ output  in javainput/ output  in java
input/ output in java
 
Java threads
Java threadsJava threads
Java threads
 
Java threading
Java threadingJava threading
Java threading
 

Similar to Inter Thread Communicationn.pptx

Inter thread communication &amp; runnable interface
Inter thread communication &amp; runnable interfaceInter thread communication &amp; runnable interface
Inter thread communication &amp; runnable interface
keval_thummar
 
Multi threading
Multi threadingMulti threading
Multi threading
gndu
 
07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx
07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx
07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx
nimbalkarvikram966
 
CS844 U1 Individual Project
CS844 U1 Individual ProjectCS844 U1 Individual Project
CS844 U1 Individual ProjectThienSi Le
 
multithreading.pptx
multithreading.pptxmultithreading.pptx
multithreading.pptx
Sravanibitragunta
 
Thread syncronization
Thread syncronizationThread syncronization
Thread syncronization
priyabogra1
 
econtent thread in java.pptx
econtent thread in java.pptxecontent thread in java.pptx
econtent thread in java.pptx
ramyan49
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
Jayant Dalvi
 
Sync, async and multithreading
Sync, async and multithreadingSync, async and multithreading
Sync, async and multithreading
Tuan Chau
 
Multithreadingppt.pptx
Multithreadingppt.pptxMultithreadingppt.pptx
Multithreadingppt.pptx
HKShab
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Kavitha713564
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Kavitha713564
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharpDeivaa
 
Java Thread
Java ThreadJava Thread
Java Thread
DeeptiJava
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
Shraddha
 
1.17 Thread in java.pptx
1.17 Thread in java.pptx1.17 Thread in java.pptx
1.17 Thread in java.pptx
TREXSHyNE
 
Multithreading Presentation
Multithreading PresentationMultithreading Presentation
Multithreading Presentation
Neeraj Kaushik
 
chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)
It Academy
 

Similar to Inter Thread Communicationn.pptx (20)

Inter thread communication &amp; runnable interface
Inter thread communication &amp; runnable interfaceInter thread communication &amp; runnable interface
Inter thread communication &amp; runnable interface
 
Multi threading
Multi threadingMulti threading
Multi threading
 
22 multi threading iv
22 multi threading iv22 multi threading iv
22 multi threading iv
 
07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx
07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx
07. Parbdhdjdjdjsjsjdjjdjdjjkdkkdkdkt.pptx
 
CS844 U1 Individual Project
CS844 U1 Individual ProjectCS844 U1 Individual Project
CS844 U1 Individual Project
 
multithreading.pptx
multithreading.pptxmultithreading.pptx
multithreading.pptx
 
Thread syncronization
Thread syncronizationThread syncronization
Thread syncronization
 
econtent thread in java.pptx
econtent thread in java.pptxecontent thread in java.pptx
econtent thread in java.pptx
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
 
Sync, async and multithreading
Sync, async and multithreadingSync, async and multithreading
Sync, async and multithreading
 
Multithreadingppt.pptx
Multithreadingppt.pptxMultithreadingppt.pptx
Multithreadingppt.pptx
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharp
 
Java Thread
Java ThreadJava Thread
Java Thread
 
Multithreading.pptx
Multithreading.pptxMultithreading.pptx
Multithreading.pptx
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
 
1.17 Thread in java.pptx
1.17 Thread in java.pptx1.17 Thread in java.pptx
1.17 Thread in java.pptx
 
Multithreading Presentation
Multithreading PresentationMultithreading Presentation
Multithreading Presentation
 
chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)
 

Recently uploaded

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 

Inter Thread Communicationn.pptx

  • 1. SNS COLLEGE OF TECHNOLOGY (An Autonomous Institutions) 19CST102 - OBJECT ORIENTED PROGRAMMING I YEAR / II SEMESTER UNIT IV – MULTITHREADING IN JAVA TOPIC : INTER THREAD COMMUNICATION Presented by: Vishnnu K.S (713522CS176) Vilashini.V (713522CS172) Guided by : Mr.Selvakumar. N AP/CSE
  • 2. Java Threads • Threads allows a program to operate more efficiently by doing multiple things at the same time. • Threads can be used to perform complicated tasks in the background without interrupting the main program.
  • 3. Inter-thread Communication in Java • Inter thread communication is all about allowing threads to communicate with each other. • It is implemented by following methods of Object class: • Wait() • Notify() • NotifyAll()
  • 4. Wait() method • The wait() method causes current thread to release the lock and wait until either another thread invokes the notify() method or the notifyAll() method for this object,or a specified amount of time has elapsed. • The current thread must own this objects monitor,so it must be called from the synchronized method only otherwise it will throw exception.
  • 5. Notify() method • The notify() method wakes up a single thread that is waiting on this object’s monitor. • If any threads are waiting on this object,one of them is choosen to be awakened. Syntax: Public final void notify()
  • 6. NotifyAll() method • Wakes up all threads that are waiting on this object’s monitor. Syntax: Public final void notifyAll()
  • 7. Understanding the process of inter-thread communication
  • 8. • The point to point explanation of the above diagram is as follows: • Threads enter to acquire lock. • Lock is acquired by on thread. • Now thread goes to waiting state if you call wait() method on the object. Otherwise it releases the lock and exits. • If you call notify() or notify All() method, thread moves to the notified state (runnable state). • Now thread is available to acquire lock. • After completion of the task, thread releases the lock and exits the monitor state of the object. Understanding the process of inter-thread communication
  • 9. Difference between wait and sleep wait() sleep() The wait() method releases the lock. The sleep() method doesn't release the lock. It is a method of Object class It is a method of Thread class It is the non-static method It is the static method It should be notified by notify() or notifyAll() methods After the specified amount of time, sleep is completed.
  • 10. Program Class Customer { Int amount=10000; Synchronized void withdraw(int amount){ System.out.println(“going to withdraw….”); If(this.amount<amount){ System.out.println(“less balance;Waiting for deposit….”); } This.amount-=amount; System.out.println(“withdraw completed….”); } Synchronized void deposit(int amount){ System.out.println(“going to deposit….”); This.amount+=amount; System.out.println(“deposit completed…”); Notify(); } } Class Test{ Public staic void main(String args[]){ New Thread(){ Public void run(){c.withdraw(15000);} }.start(); New Thread(){ Public void run(){c.deposit(10000);} }.start(); }}
  • 11. OUTPUT going to withdraw…. less balance;waiting for deposit….. going to deposit….. deposit completed…. withdraw completed