EN
Java - how to check string length?
0 points
In Java it is possible to check string length in following way.
xxxxxxxxxx
1
public class StringExample {
2
3
public static void main(String[] args) {
4
String text = "This is my text...";
5
String anotherText = "Another text...";
6
7
System.out.println(text.length()); // 18
8
System.out.println(anotherText.length()); // 15
9
}
10
}
Output:
xxxxxxxxxx
1
18
2
15