Consider an integer array, vals, which has been declared with one or more integer values. Which of the code segments updates vals so that each element contains the current value less 2?
for (int v: vals)
{
v = v −2;
}
for (int m = 0; m < vals.length; m++ )
{
vals[m] = vals[m] −2;
}
int m = 0;
while (m < vals.length)
{
vals[m] = vals[m] − 2;
}
II only
III only
I and III
II and III
I, II, and III