Lesson 4.1 · College Board Unit 1
String Indexing
A String of length n has valid character indices 0 through n - 1. Use substring(i, i + 1) to obtain a one-character String.
Code Scholars Tutoring · AP Computer Science A
Work with immutable text using String methods and iteration. Character indexes run from zero through one less than the length. Substring boundaries may reach the length, and calling a String method leaves the original contents unchanged.
Lesson 4.1 · College Board Unit 1
A String of length n has valid character indices 0 through n - 1. Use substring(i, i + 1) to obtain a one-character String.
Lesson 4.2 · College Board Unit 1
substring includes its start index and excludes its end index. indexOf returns the first matching index, or -1 when there is no match.
Lesson 4.3 · College Board Unit 1
String methods return values without changing the original object. Assign the result when a transformation should replace a variable's current value.
Lesson 4.4 · College Board Unit 1
Traverse indices less than length, extract each one-character substring, and use equals for content comparison.
Work through questions with a tutor and get help with the steps you find difficult.
Get help with this topic