I have read about marking an object as volatile doesn\'t guarantee visibility of it\'s members ( I\'m not saying about thread safety just memory visibility
happens-before
relationship will gurantees that. While volatile keyword also builds happens-before
relationship between the write thread and the read thread.Using volatile variables reduces the risk of memory consistency errors, because any write to a volatile variable establishes a happens-before relationship with subsequent reads of that same variable.