Why String is Immutable in Java - thejavaconceptspart

Why String is Immutable in Java - thejavaconceptspart

Why String is Immutable in Java

String is Immutable in Java because:-

  1. String pool requires string to be Immutable otherwise shared reference can be changed from anywhere.
  2. Security because string is shared on different area like file system, Networking connection, Database connection, having Immutable string allows you to be secure and safe because no one can change reference of string once it gets created.
Please Leave a Comment Below⬇

Comments

Post a Comment

Remember to keep Comments Respectfully

Popular posts from this blog

Java & Java Uses - thejavaconceptsparts

Buzzword in Java - thejavaconceptspart

Java Naming Conventions - thejavaconceptspart