Answer:
(userVal < 0) ? "negative" : "non-negative" ;
Explanation:
The above code has been written using Java's ternary operator (? : ).
Java uses this operator to write conditional expressions that are similar to the regular if ... else statements.
This expression has three parts,
i. the conditional statement: this is the expression before the ? mark. In this case, (userVal < 0). This expression contains the condition to be tested for and it returns true or false.
ii. the second part is the statement after the ? mark. In this case, "negative". This expression will be executed if the conditional statement returns true.
iii. the third part is the statement after the : mark. In this case, "non-negative". This expression will be executed if the conditional statement returns false.
So in this case, if userVal < 0, the string "negative" will be evaluated. Otherwise, "non-negative".