<code>for (int i = 0; i <= arr.length; i++)</code> (note <code><=</code>) on a length-5 array
- A
Compile error
- B
Works fine
- C
Skips one element
- Dcheck_circle
Throws ArrayIndexOutOfBoundsException at i=5
Explanation
Valid indices are 0..length-1; <code><=</code> would access index <code>length</code> (out of bounds).