posted 25 years ago
Wel,, since you've successfully compiled and run the code, you've effectively ruled out options A,C,D and E - leaving B "method should be synchronized".
increment() is both reading and re-setting a class variable, which makes it especially prone to weird results if another thread just happens to invoke increment() on the same object at the same time. OK, unlikely but possible (and it's pretty difficult to consistently generate this test-case).
This could be considered being over-the-top, but then just adding "synchronized" is a very simple step for peace-of-mind.