Hi
I wondered if the variable x can be accessed while another thread holds the object lock (mostly because of confusion with the volatile keyword, which is not part of the exam).
After writing a
test code, the answer is "yes", the variable can be changed despite the lock.
So, wouldn't it make sense to allow class variables to be declared synchronized? Why can't they?
Any input would be nice...