I was reading about Immutable objects in java.
There is a statement which states - "Immutable objects are thread-safe". I need more clarification for the above statement:
If I have a shared resource of type 'String' which is shared with multiple threads (say 3) And if one of the thread make changes to the shared reference, it will create a new String object and that will available only with that Thread object and other threads will not get to know about the changes made by one of the thread.
Will it not lead to data inconsistency?
So could anyone please help me understand this?
Thanks in advance.