Java String class

Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. The String class represents character strings. All string literals in Java programs, such as “abc”, are implemented as instances of this class.

The String class is immutable, so that once it is created a String object cannot be changed. If there is a necessity to make a lot of modifications to Strings of characters, then you should use String Buffer & String Builder Classes.

The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase. Case mapping is based on the Unicode Standard.

Related Tags

Tutorials

Why are Strings Immutable in Java?

The immutable strings help in achieving the required data safety and performance in a Java application with help of underlying string pool.

Java String Interview Questions

All of us must have gone though interview questions related to String class in java. These String interview questions range from immutability to memory leak issues.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.