0
Why do we learn those complicated equations of unary operators when studying Java?
6 odpowiedzi
+ 1
Because these are widely used and not complicated. You can skip this topic and come back to it later, or try to find explanation in a different source. Sometimes it's the best way.
+ 1
You should learn about operators precedence...
In your equation you use two unary operator (++ and --) and also arytmethic operators, (* and -)...
Consult the Oracle documentation for best understanding...
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html
+ 1
Gurkirpa Singh nobody writes like that in real life. That's a crappy code. These kind of equations are only for education. When you are solving them, use pen and paper.
0
Unary operators are special symbols that perform specific operations on one operand, and then return a result.
As we explore the operators of the Java programming language, it may be helpful for you to know ahead of time which operators have the highest precedence, that can be a good reason...
They are just five:
"+" >> Plus operator, indicates positive value.
"-" >> Minus operator, negates an expression.
"++" >> Increment operator, increments the value by one.
"--" >> Decrement operator, decrements the value by one.
"!" >> Logical complement operator, inverts the value of a boolean.
0
Aleksandrs Kalinins but the equations like X++ - ++X - --X*X++ X... Can get complicated. Why are they even relevant?
0
They are relevant in the way that you can simplify expressions...