Home | | Web Programming | String Length - Java

Chapter: Java The Complete Reference : The Java Library : String Handling

String Length - Java

The length of a string is the number of characters that it contains. To obtain this value, call the length( ) method, shown here:

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());


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Java The Complete Reference : The Java Library : String Handling : String Length - Java |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.