File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Banking with Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Banking with Threads" Watch "Banking with Threads" New topic

Banking with Threads

Urs Waefler
Ranch Hand

Joined: Mar 13, 2007
Posts: 77
I must solve the following task: There are 2 persons in a bank. 1 Person puts the amount x to an account, the other person withdraws the same amount at the same time from the same account. This is my code so far:

It must be improved. In general it seems to go in the right direction, nevertheless it is not good. Who can help me?

SCJP 1.4
I agree. Here's the link:
subject: Banking with Threads
It's not a secret anymore!