int length():
It is used to find out the length of the string
Difference between langth() method and langth variable:-
length()----?method
length--?variable
length is available in array to find the length of the array
Ex:-
int [] a={10,20,30};
System.out.println(a.length);//3
length() is method used to find the length of the given string.
Ex:-
String str="venkat";
System.out.println(str.length());//6
Signature
The signature of the string length() method is given below:
public int length()
String Length program
class Test 
{ 
public static void main(String[] args) 
{ 
String str="venkat"; 
System.out.println(str.length()); 
System.out.println("freetmielearn".length()); 
int[] a={10,20,30}; 
System.out.println(a.length); 
} 
}
Output :
6,13,3