Why do we learn those complicated equations of unary operators when studying Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do we learn those complicated equations of unary operators when studying Java?

22nd Sep 2020, 4:40 AM
DerAviator
DerAviator - avatar
6 Answers
+ 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.
22nd Sep 2020, 5:03 AM
Aleksandrs
Aleksandrs - avatar
+ 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
22nd Sep 2020, 5:29 AM
Jesús Roberto GR 🇲🇽
Jesús Roberto GR 🇲🇽 - avatar
+ 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.
22nd Sep 2020, 5:40 AM
Aleksandrs
Aleksandrs - avatar
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.
22nd Sep 2020, 5:18 AM
Jesús Roberto GR 🇲🇽
Jesús Roberto GR 🇲🇽 - avatar
0
Aleksandrs Kalinins but the equations like X++ - ++X - --X*X++ X... Can get complicated. Why are they even relevant?
22nd Sep 2020, 5:23 AM
DerAviator
DerAviator - avatar
0
They are relevant in the way that you can simplify expressions...
22nd Sep 2020, 5:31 AM
Jesús Roberto GR 🇲🇽
Jesús Roberto GR 🇲🇽 - avatar