Consider the following code:
int diff = 0;
if (Math.abs(num1 - num2) == (num1 - num2))
{
diff = num1 - num2;
}
else if (Math.abs(num2 - num1) == (num2 - num1))
{
diff = num2 - num1;
}
Which of the following will have the exact same result?
I.
int diff = Math.abs(num1) - num2;
II.
int diff = Math.abs(num1 - num2);
III.
int diff = Math.abs(num2 - num1);
II and III only
I only
I sets diff to the absolute value of num1 minus the value of num2. This could be negative, while in the code segment diff is always positive.
II only
I, II, and III
III only