Page 1322 - AP Computer Science A, 7th edition
P. 1322
20. (E) The expression word.indexOf(“flag”) returns the index of the first occurrence of “flag” in the calling string, word. Thus, x has value 3. (Recall that the first character in word is at index 0. ) T he m et hod c all word.substring(0, x) is equiv alent t o word.substring(0, 3), w hic h ret urns t he substring in word from 0 to 2, namely “con”. The character at index 3 is not included.