Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is synchronized? 1

Status
Not open for further replies.

tkforever

Programmer
Nov 13, 2003
6
US
I am looking at sample code and the project basically uses ServerSockets for a simple BankAccount thing. The commands that the client will use are deposit withdraw and getBalance. These methods have:

public synchronized void deposit(double amount)

Can anyone please explain to me what synchronized does? Is it for the threads?

thanks
tk
 
A synchronized method means that only one thread can run it at a time. Other threads are locked out to protect resources from interference by multiple access at one time.

-kaht

banghead.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top