A group of characters enclosed in double quotations make up a Stringvariable:
Example
Create a variable of type Stringand assign it a value:
String greeting = "Hello";
String Length
In Java, a string is essentially an object that has methods on it that may be used to manipulate strings. For instance, the length() method can be used to determine the length of a string:
Example
String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
System.out.println("The length of the txt string is: " + txt.length());
More String Methods
Numerous string methods exist, such as toLowerCase() and toUpperCase():