AP® Computer Science A glossary

Index

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

The position of a character in a String, counted from 0. Valid indices run from 0 to length() - 1.

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

In "ROBOT", R is at index 0 and T is at index 4. Arrays and lists in Unit 4 also use indices that start at 0.

String s = "ROBOT";
System.out.println(s.substring(4, 5));

Output:

T
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