Under which conditions will check() return true when called from a different class?
A.check() can never return true.
B.check() can return true when setXY is callled by multiple threads.
C.check() can return true when multiple threads call setX and setY separately.
D.check() can only return true if SychTest is changed allow x and y to be set separately.
--------------------------------------------
To this question,my answer is C, is it right?
and i think LOCK relate Object, not method.
Hence if one
thread access setXY method or check method (both are
Synchronized), the Object refence which to SychTest cann't be accessed by others.No other methods can be invoked.(such as setX ,setY)
Am I right?if something wrong,Please let me know.Thanks.