<code>"hello".indexOf('z')</code> returns
- A
0
- B
Throws exception
- C
5
- Dcheck_circle
−1
Explanation
<code>indexOf</code> returns -1 when the character is not found.
AP Computer Science A· difficulty 3/5
<code>"hello".indexOf('z')</code> returns
0
Throws exception
5
−1
Explanation
<code>indexOf</code> returns -1 when the character is not found.
Want 10 more like this — adaptive to your weak spots?