This documentation is archived and is not being maintained.


Visual Studio 2005

Gets the length of the String, which is the number of Unicode characters in the String.

public int length()

The length of the String.

// string_length.jsl

public class Program
    public static void main(String[] args)
        String str = "How long is this String? ";

        // Get the length of str.
        int len = str.length();

        // Display the results of calling length.
        System.out.println(str + len);

How long is this String? 25