Originally posted by Vanitha Sugumaran:
When is a class thread-safe? I thought if a class has synchronized methods then it is thread-safe, (I know it is not correct )? Vector class is thread-safe how?
Can anyone explain this?
There is more to being
thread safe than just synchronizing some methods. Being thread safe means that no matter how many threads interact with an object, the object will maintain internal consistency and will suplly correct and meaningful data to each thread it interacts with. No thread will be able to corrupt the results of another thread by changing data and making it inconsistent.