Make sure everything works synchronously. Or, more precisely, due to synchronization. Synchronizing a method call means that two different calls to this method (on this object, if it is not static) must enter the method in turn. Thread B cannot enter the synchMeth method until Thread A ends (already in the method).
, , .