Delete comment from: Javarevisited
This line dose not make sense
String A = "Test"
String B = "Test"
Now String B called "Test".toUpperCase() which change the same object into "TEST" , so A will also be "TEST" which is not desirable.
If you do toUpperCase() to String B, why string A wll get affected?
In this example Strign A and String B will have different memory location.
Jun 13, 2015, 1:52:34 PM
Posted to Why String is Immutable or Final in Java? Explained