This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Banking with Threads" Watch "Banking with Threads" New topic
Author

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: http://aspose.com/file-tools
 
subject: Banking with Threads
 
Similar Threads
Program like ATM where person enters amount in dollars and cents but program uses int for monies
Bank account simulation
How to get a transfer function to work both ways?
Thread question
java.lang.IllegalThreadStateException