Give reasons supporting that String is immutable.

Sharad Jaiswal
Sharad Jaiswal

Posted On: Feb 22, 2018

 

Some of the reasons why String is considered as immutable with respect to Java include the following:

  • Security: String is made unchanging to help increment the Security. Delicate information like username, a password can be put away as the Strings cannot be altered once made.
  • Class stacking: String objects are utilized for Class stacking. It is conceivable that wrong class has been stacked in the JVM if the String is changeable that is modifiable.
  • String Safe: Immutable Strings are string safe. Synchronization is not required when we use them in the multithreading condition.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Java String interview Questions

    What do you understand by the term String with respect to Java?

    With respect to Java, a String can be attributed internally by a variety of byte esteems..

    Java String interview Questions

    Describe String intern() methodology

    As indicated by Oracle records, when the intern methodology..