I have a class which looks something like this:
public class Test {
private static final Object someObject = new Object();
public void doSomething()
{
synchronized (someObject) {
System.out.println(someObject.toString());
}
}
}
Can I consider the object to be synchronized, or is there a problem since it is a static member?
Edit: note that different threads might be accessing doSomething() and the object must be accessed in a thread-safe manner in that case.