For this question, assume we have an array of
boolean values called arr that has a length of 5. We want
to print out the elements in arr in reverse order.
for (int i = arr.length; i >= 0; i--)
{
System.out.println(arr[i]);
}
What is wrong with this loop?
This would throw an ArrayIndexOutOfBoundsException. The last value in arr is stored at index 4 (one less than length).
- This would throw an IncompatibleTypeException as we can't iterate through an array of booleans.
- This would cause a syntax error because the square brackets ([]) are used incorrectly.
- This loop has no problems and would run without issue.
There are no hints for this question