aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes synchronized - K&B sample Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "synchronized - K&B sample" Watch "synchronized - K&B sample" New topic
Author

synchronized - K&B sample

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
I modified money withDrawal illustration in K&B book by putting makeWithDrawal() method in another class called AccountTrans.

But I got different behaviour/output, until I put that line which called makeWithDrawal() in synchronized(this) block.

anyone can explain why I need to synchronized on "this" object and
synchronized on "public void makeWithDrawal" doesn't work anymore?

hope make sense




SCJP 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: synchronized - K&B sample