String
Length
The length of a string is the
number of characters that it contains. To obtain this value, call the length( ) method, shown here:
int length( )
The following fragment prints
"3", since there are three characters in the string s:
char chars[] = { 'a', 'b', 'c' }; String s =
new String(chars); System.out.println(s.length());
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.