Get the Length of a String in Java
public class Test { public static void main(String[] args) { String str = “Learn Java with alegrucoding.com”; System.out.println(str.length()); } } Output: 32 Also, we can use the for loop to count characters in a String. public class Test { public static void main(String[] args) { int count = 0; String str = “Learn Java…
Read More Get the Length of a String in Java