- To find the string length
User Input: Hello World
Output: 11
import java.util.Scanner;
public class StringLength {
public static void main(String []args) {
String s1;
Scanner userInput = new Scanner(System.in);
System.out.print("Enter Your string : ");
s1 = userInput.nextLine();
System.out.println("String length : "+s1.length());
}
}
Enter your string : Blue Sky String length : 8Program
Coming Soon !
QuickIn order to succeed you must fail, so that you know what not to do the next time.