title: How to make state variable thread safe
body: <p>Suppose I have a class having static member variable.There are two synchronized methods,static and instance, present in that class and both the methods are trying to modify the value of static member variable. First thread is having lock on object of that class , so first thread can access both static synchronized and instance synchronized method. Second thread is having class level lock , so it can access only static synchronized method. In this scenario , how to achieve thread safety.</p>