Previous Lecture Lecture 8 Next Lecture

Lecture 8, Thu 01/16


num: Lecture 8 lecture_date: 2019-10-23 desc: ready: false pdfurl: —

Immutability of String in Java

Objects of type String in Java are immutable.

They cannot be changed after they are initially created.

So, if I write:

String name = "Phill";
name = name + "ip";

Now, name refers to a String “Phillip”.

No. String is still immutable.

How do we explain this?