Introduction
The char type represents only one character. To represent a string of characters, use the data type called String.
Example:
String message = "Welcome to Java";
String is actually a predefined class in the Java library just like the System class. The String type is not a primitive type. It is known as a references type.
Strings are more commonly concatenated with the + operator.
Example:
String message = "Welcome " + "to " + "Java";
The value of message will be Welcome to Java.
Exercise:
What is the value of s and s1 in the following statements?
String s = "Chapter" + 2;
String s1 = "Supplement" + 'B';