Java length() Method


The String length() method is used to find the length of the string. It returns the count number of characters.


Syntax:

 public int length() 

Example:

public class Length
{   
	public static void main(String args[])
    {  
    	String s1="Onlinetpoint";    
		System.out.println(s1.length());
    }
} 



Onlinetpoint is optimized for basic learning, practice and more. Examples are well checked and working examples available on this website but we can't give assurity for 100% correctness of all the content. This site under copyright content belongs to Onlinetpoint. You agree to have read and accepted our terms of use, cookie and privacy policy.