Which operator can be used to invert the sign of a numeric expression?
- !
- +
- -
- ~
The - (minus) operator can be used to invert the sign of a numeric expression. For example, if you have a variable int x = 5;, then -x would give you -5. The other options are not used for inverting the sign of numeric values.
Loading...
Related Quiz
- Consider a case where you have to model a "Book" in a library system. What properties and methods would you define in the Book class and why?
- What is the significance of a copy constructor in Java?
- Which interface or class should a class use or extend to create a new thread in Java?
- The ________ interface of the JDBC API provides cursor support, which allows forward and backward navigation through the result set.
- Consider a scenario where you are tasked with designing a distributed application where objects need to be serialized and transmitted over the network. How would you optimize the serialization process to ensure minimal network usage and maximize performance?