Ace Java 2025: Rock Your 'Thinking in Java' Challenge!

Question: 1 / 510

What does the unary minus operator do in Java?

Negates the operator

The unary minus operator in Java is used to negate a value, i.e., changing a positive value to a negative value or vice versa. This means that it performs the opposite operation of the given value. The other options, such as removing a minus sign if present or doubling the value, are not the expected behavior of the unary minus operator. Additionally, while the operator may convert a negative value to a positive value, its main purpose is to simply negate a value. Therefore, the best answer choice is A.

Get further explanation with Examzify DeepDiveBeta

Removes minus sign if present

Doubles the value

Converts to positive if negative

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy