Why are strings immutable in Java?

Last Updated :
Discuss
Comments

Why are strings immutable in Java?

To enable multiple inheritance

To avoid garbage collection

For security and thread safety

All of the above

Share your thoughts in the comments