Table of Content 9
What is String?
- String is a collection of characters.
- In Java, String is a pre-defined class
- String is immutable. Therefore, it can’t be changed once the value is assigned to a string variable.
String name = “BBS”;
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.