I think methods increment() and reset() should be synchronized for thread safety. Am i right.
posted 9 years ago
the variable Count is private. I am assuming a scenario where a single object of the class ThreadsEX4 is created & its reference is passed on to two threads, so that each thread can acces the varible & modify it. In this i would suggest even the getCount method to be synchronized. Though i am not sure.