Languages
[Edit]
EN

Java - how to check string length?

0 points
Created by:
Sylvie-Justice
490

In Java it is possible to check string length in following way.

1. String length() method example

public class StringExample {

    public static void main(String[] args) {
        String text = "This is my text...";
        String anotherText = "Another text...";

        System.out.println(text.length()); // 18
        System.out.println(anotherText.length()); // 15 
    }
}

Output:

18
15
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - String (popular problems)

Java - how to check string length?
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join