In this chapter, you will learn:

  • What a String object is
  • How to create String objects
  • How to use String literals
  • How to manipulate Strings
  • How to use Strings in a switch statement
  • How to use StringBuilder and StringBuffer objects to work with mutable strings

What is a String?

A sequence of zero or more characters is known as a string. In Java programs, a string is represented by an object of the java.lang.String class. The String class is immutable. That is, the contents of a String object cannot be modified after it has been created. The String class has two companion classes, java.lang.StringBuilder and java.lang.StringBuffer ...

Get Beginning Java 8 Fundamentals: Language Syntax, Arrays, Data Types, Objects, and Regular Expressions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.