What are the unary operators in Java?

Java 8Object Oriented ProgrammingProgramming

These are the operators which act on only one operand. There are three kinds of unary operators Assume integer variable A holds 10 –

OperatorDescriptionExample
- (Unary Minus)This operator is used to negate a given value.-10
++(Increment Operator)This operator is used to increment the value of a variable by 1.++10 gives 11
--(DecrementOperator)This operator is used to decrement the value of a variable by 1.--11 gives 10
raja
Published on 12-Jan-2018 14:39:51
Advertisements