2.6 String Objects: Concatenation, Literals, and More
Enduring Understanding
To find specific solutions to generalizable problems, programmers include variables in their code so that the same algorithm runs using different input values.
Learning Objective
For String class:
a. Create String objects.
b. Call String methods.
Essential Knowledge
String objects can be created by using string literals or by calling the String class constructor.
String objects are immutable, meaning that String methods do not change the String object.
String objects can be concatenated using the + or += operator, resulting in a new String object.
Primitive values can be concatenated with a String object. This causes implicit conversion of the values to String objects.
Escape sequences start with a \ and have a special meaning in Java. Escape sequences used in this course include \”, \, and \n.
Last updated
Was this helpful?