file lock and shared lock... and any other lock if java have....
Main Topics
Browse All Topicshi there
can anyone explain the difference between synchronize and lock in java.. with example...
if we use synchronize keyword to a method,it means at one time one thread can access it(if i am wrong correct me)..right?... how abt lock...
anyhelp will be greatly appreciated..
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
-Every object in Java has a built-in LOCK that only comes into play when the object has synchronized method code.
-Each object has just one lock.
-If two threads are about to execute a synchronized method in a class, and both threads are using the same instance of the class to invoke the method, only one thread at a time will be able to execute the method.
So, you can realize that LOCK and SYNCHRONIZE come together.
heres an example
http://www.exampledepot.co
Business Accounts
Answer for Membership
by: objectsPosted on 2009-11-06 at 12:54:40ID: 25762950
thats correct, what lock exactly are you referring to?