5 String APIs
| Exam objectives covered in this chapter |
What you need to know |
| [3.4] Creating and manipulating Strings |
How to initialize String variables using String literals and new operator. Use of the operators =, +=, !=, and == with String objects. Pooling of string literal values. Literal value for class String. Usage of methods from class String. Immutable String values. All the String methods manipulate and return a new String object. |
| [3.5] Manipulate data using the StringBuilder class and its methods |
How to create StringBuilder classes and how to use their commonly used methods. Difference between StringBuilder and String classes. Difference between methods with similar names defined in both classes. |
| [3.4] Creating and manipulating Strings |
How to initialize String variables using String literals and new operator. Use of the operators =, +=, !=, and == with String objects. Pooling of string literal values. Literal value for class String. Usage of methods from class String. Immutable String values. All the String methods manipulate and return a new String object. |
In the OCP Java SE 11 Programmer I exam, you’ll be asked many questions about how to create, modify, and delete String and StringBuilder objects. To prepare you for such questions, in this chapter I’ll provide insight into the variables you’ll use to store these objects’ values, along with definitions for some of their methods.
In this chapter, we’ll cover the following: