Correct Answer: If a class has synchronized code, multiple threads can still access the nonsynchronized code.
Explanation:
A is incorrect because static methods can be synchronized; they synchronize on the lock on the instance of class java.lang.Class that represents the class type.
C is incorrect because only methods—not variables—can be marked synchronized.
D is incorrect because a sleeping thread still maintains its locks.
Discussion & Comments