4.8. Review notes

This section lists the main points covered in this chapter.

The class String:

  • The class String represents an immutable sequence of characters.
  • A String variable can be initialized by using the operator new or by using the assignment operator with String literal values.
  • String objects created using a String literal without the new operator are placed in a pool of String objects. Whenever the JRE receives a new request to initialize a String variable using the assignment operator, it checks whether a String object with the same value already exists in the pool. If one is found, it returns the object reference for the existing String object from the pool.
  • String objects created using the operator new are never placed in the pool ...

Get OCA Java SE 8 Programmer I Certification Guide 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.