Threads that share data may get in each others way and end with corrupt data. In order to avoid this problem, a thread must be allowed to complete its update of data without interruption. Locks, in the form of synchronized methods or blocks, provide this solution.