CoreJavaTutorials
Contribute Us | Ask Question |

String

To Store two or more characters (like name) in a single variable we use String class in java.String is like an array of characters

String is a very special class that provide many operation and method to work with, like compare two string or match username and password enter on a form etc.

It is an object that contain character or series of characters and found in The java.lang.String package (by default) . It implements Serializable, Comparable and CharSequence interfaces.

The java String is immutable in nature means it cannot be changed once created but a new instance can be created. For mutable class, we can use StringBuffer and StringBuilder(Added in JDK 5) class.

How to create String object