The length of a string is the number of characters that it contains. To obtain this value, call the length( ) method
int length( )
char chars[] = { ‘a’, ‘b’, ‘c’ };
String s = new String(chars);
System.out.println(s.length());
This will show “3”
The length of a string is the number of characters that it contains. To obtain this value, call the length( ) method
int length( )
char chars[] = { ‘a’, ‘b’, ‘c’ };
String s = new String(chars);
System.out.println(s.length());
This will show “3”