Loading topic
String is an object that represents a sequence of characters. In Java, a String is immutable, which means that its character content cannot change after the object is created.3 min readString class. You should also know that a String is an object, while an int is a primitive value.3 min readString class, and the difference between objects and primitives. The examples use Java 15 or later, although StringBuilder itself is available in older Java versions.2 min readString class. You should also know that String objects are immutable. StringBuilder is mutable, so its existing character sequence can change without creating a new builder for every edit.2 min readString objects cannot be changed after creation.2 min readString class. You should also know how to compile and run a Java program. The examples use Java 15 or later, although StringBuilder and StringBuffer are older classes.3 min readString class. You should also know how to compile and run a Java program. Text blocks require JDK 15 or later.3 min readString literals. This chapter also assumes Java 15 or later, because text blocks became standard in Java 15.2 min readString class. This chapter uses text blocks, which require JDK 15 or later. A text block is a multi-line string literal that starts and ends with three double-quote characters.3 min readString class, method calls, and text-block delimiters. Text blocks require JDK 15 or later. A text block is still an ordinary String; these methods create and return other String values rather than changing the original.3 min readString class, and the difference between objects and primitives. This chapter compares common ways to create and combine text: +, StringBuilder, String.join, text blocks, and formatted.3 min read