String In Java Example1 min read

Java Code:


String is a sequence of characters.

Java String provides a lot of concepts that can be performed on a string such as compare, concat, equals, split, length, replace, compareTo, intern, substring etc.

Syntax : String greeting = “Welcome to Code4Example!”;

The java.lang.String class implements Serializable, Comparable and CharSequence interfaces.

The java String is immutable i.e. it cannot be changed but a new instance is created. For mutable class, you can use StringBuffer and StringBuilder class.

Leave a Comment