AP® Computer Science A glossary

length()

Also called: length

Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods

The String method that returns the number of characters in a String.

Appears in the course and exam description (CED): 1.15.B.2

Each escape sequence counts as one character. The empty string "" has length 0.

System.out.println("INTERFACE".length());
System.out.println("".length());

Output:

9
0
Learn it properly, with a checkpoint 1.15 String Manipulation

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure