Introduction to Strings

The String class is a class in the java.lang package, not the underlying data type, which is implemented using char arrays

2 String is final and cannot be inherited. Serializable can be serialized

3 Strings are thread-safe, immutable classes

String creation

1 New keyword: An object is created in the JVM’s heap memory

2 Double quote “” creates an object in the constant pool

3 String concatenation + uses StringBuider and appends toString, nullabc = null+ “ABC”