why string is immutable code example

Example 1: why are string immutsble in java

In java, string objects are immutable. Immutable simply means unmodifiable or unchangeable.

Once string object is created its data or state can't be changed but a new string object is created.

Example 2: why string immutable in java

In java, string objects are immutable. 
Immutable basically means unmodifiable
or unchangeable.
Once string object is created its data or
state can't be changed but a new
  string object is created

Tags:

Java Example