AP® Computer Science A glossary
Immutable
Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods
Cannot be changed once created. String objects are immutable: their methods return new strings and never change the original.
Appears in the course and exam description (CED): 1.15.A.3
To keep the result of a String method, store it: w = w.substring(1);.
String w = "data";
w.substring(1);
System.out.println(w);
Output:
data Learn it properly, with a checkpoint 1.15 String Manipulation