+ 10

what is unary operator in java

31st May 2017, 9:47 AM
ABADA S
ABADA S - avatar
3 Respuestas
+ 18
The unary operators requires only one operand to perform different kind of operations such as increasing/decreasing a value, negating an expression, or inverting a boolean value. For eg., - the increment (++) and decrement(--) operators are unary : int x = 0;  int y = 0;  y = ++x;  System.out.println(x);   System.out.println(y);   } } // The output of this program shows that always 1 is stored in both variables i.e. the value of "x" is incremented first then it is assigned to the variable "y". There are many more examples here : http://www.roseindia.net/java/master-java/unary-operators.shtml https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html
31st May 2017, 9:59 AM
Dev
Dev - avatar
+ 2
ok
1st Jun 2017, 6:33 AM
Santiago Betancur Villegas
Santiago Betancur Villegas - avatar
+ 2
ok very good
1st Dec 2017, 5:57 AM
Santiago Betancur Villegas
Santiago Betancur Villegas - avatar