Saved Bookmarks
| 1. |
Is String immutable or final in Java? If so, then what are the benefits of Strings being Immutable? |
|
Answer» Yes, Strings are immutable in Java. Immutable objects MEAN they can't be changed or ALTERED once they've been created. HOWEVER, we can only modify the reference to the string object. The String is immutable in Java because of many reasons LIKE security, CACHING, synchronization and concurrency, and class loading. |
|