This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
winny, java has provided synchronization to tackle the RACE CONDITIONS, which means two (or more) threads are competing for a single resource. If the access is not mutually exclusive,( i.e. while one thread is updating/accessing a variable any other thread cannot acces/update the value of this particular variable), then this perticular resource would end up in having inconsistent state.
One at a time acces (i.e. synchronization) helps us overcome this problem.
Synchronization can be provided by different ways, e.g. using synchronized block or synchronized method. There are many links which have detailed explainations regarding these two approaches.
However if you have hit on any particular problem, post it, so that people can help you.
actually i was doing producer consumer problem using threads in which a race condition occurs ...so can i remove that race condition with synchronization and without synchronization both??