Java String Length Example
Chapter:
String Handling
Last Updated:
11-06-2016 05:45:42 UTC
Program:
/* ............... START ............... */
public class JavaStringLength {
public static void main(String[] args) {
// declare the String object
String str = "Java String";
int length = str.length();
System.out.println("String Length : " + length);
}
}
/* ............... END ............... */
Output
Output:
String Length : 11
Notes:
-
Java String Length : str.length().
- String length is equal to the number of 16-bit Unicode characters in it.
Tags
Java String Length, Java