140. JAVA Program to find the length of the string using static.
How does this program work?
- This program is used to find the length of the string using static using java.
Here is the code
//To find the length of the string using static
import java.util.Scanner;public class length
{
public static void main(String args[] )
{
String a,b;
System.out.println("Enter a string" );
Scanner obj=new Scanner(System.in );
a=obj.nextLine();
System.out.println("Length of a string is:" );
System.out.println(a.length() );
}
}