Q 35 - Immutable strings #40
Unanswered
HARSHITH-MV
asked this question in
Q&A
Replies: 1 comment
-
🧵 Strings in Java are immutable once created, they cannot be changed. This may seem limiting at first, but it’s a clever design choice with several powerful benefits: 🚀 Benefits of String Immutability
🔧 How It WorksWhen you modify a String, you're not changing it you’re creating a new one: String name = "Java";
name = name.concat(" Rocks!"); This doesn't change |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why are Strings immutable in Java?
Beta Was this translation helpful? Give feedback.
All reactions