Hi.. I am Indrajeet Prajapati
I am having doubt that what is the main difference between java String Class and java Integer Class in term of mutable and immutable
Printable View
Hi.. I am Indrajeet Prajapati
I am having doubt that what is the main difference between java String Class and java Integer Class in term of mutable and immutable
String objects are immutable.
Integer objects are immutable.
Period. Full stop.
Cheers!
Z
Hi Indrajeet Prajapati,
Both String and Integer classes are immutable(You might have noticed keyword "final" in the class definition). Immutable objects are nothing but their values cannot be changed. For example if you try to change the value of a string, you will get a completely new string object(Not that object gets modified).
Hope i'm clear.