Question 10
Consider the following code segment.
boolean[] oldVals = {true, false, true, true};
boolean[] newVals = new boolean[4];
for (int j = oldVals.length - 1; j >= 0; j--)
{
newVals[j] = !(oldVals[j]);
}
What, if anything, will be the contents of newVals as a result of executing the code segment?
A
{true, true, false, true}
B
{true, false, true, true}
C
{false, true, false, false}
D
{false, false, true, false}
E
The array newVals will not contain any values because the code segment does not compile.