Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   Java (http://siteownersforums.com/forumdisplay.php?f=12)
-   -   Why string objects are immutable in java? (http://siteownersforums.com/showthread.php?t=348786)

Pavan Techn 05-29-2018 08:47 AM

Why string objects are immutable in java?
 
Because java uses the concept of string literal. Suppose there are 5 reference variables,all referes to one object "sachin".If one reference variable changes the value of the object, it will be affected to all the reference variables. That is why string objects are immutable in java.


All times are GMT -7. The time now is 08:29 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.