DEV Community

Discussion on: Java: 4 ways to create a String! 💡

Collapse
ip127001 profile image
Rohit Kumawat

Does immutable means I can't set value of name[Below code]?

   String name = "Rick";
   name = "Morty";

If not, can you explain immutability in String via an example? That would be helpful.

Thanks