© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
J. FriesenLearn Java Fundamentalshttps://doi.org/10.1007/979-8-8688-0351-2_13

13. String and StringBuffer

Jeff Friesen1  
(1)
Dauphin, MB, Canada
 

Chapter 1 briefly referred to the String type in the context of String[] args. This type showed up in subsequent chapters without a proper discussion. This chapter addresses this oversight by properly introducing you to String. It then introduces String’s companion type: StringBuffer.

String

The java.lang.String class describes a string, which is a sequence of characters. You express a string literally by placing these characters between a pair of double quotes (e.g., "The quick brown fox jumps over the lazy dog."

Get Learn Java Fundamentals: A Primer for Java Development and Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.