52.7k views
1 vote
The length property of the String object returns

the number of words in the string

the index of the first character in the string

the index of the last character in the string

the number of characters in the string

User Jack Jia
by
5.2k points

1 Answer

6 votes

Answer:

the number of characters in the string.

Step-by-step explanation:

length property of a String object returns the total count of the characters in the string or provides the length of the string simply.

For example:-

import java.util.*;

import java.lang.*;

import java.io.*;

class length

{

public static void main (String[] args)

{

String s="IamNumber4";

int l=s.length();//using length method on string object..

System.out.println(l);

}

}

Output:-

10

The code written above is in java.The length() method returned the count of characters of the string s that is a actually 10.

User Rahul Patel
by
4.9k points