In this example we will show the method to find the length of a string in Java.
Source Code
package com.beginner.examples;
public class StringLength {
public static void main(String[] args) {
String str = "36n8cbwqb";
System.out.println(str.length()); // get the length of a string
}
}
Output:
9