Java uses the concept of String literal. Suppose n reference variables refer to one object “codesjava”. If one reference variable changes the value of the object, it will be affected to all other n-1 reference variables. That’s why string objects are immutable in java.