- 1
When different operators like +,-,/,++,--,(),%, come in a single statement, What's the order of execution?
this is not given in the java course. so i asked An example m=((a%b)/c+x *b -3.14+t) if spaces are used the value changes too.
3 Respostas
+ 10
Arithmetic operators are used in mathematical expressions in the same way that they are used in algebraic equations.
Brackets first.
Modulo, division and multiplication come next and are evaluated from left to right.
Addition and subtraction come later and are evaluated from left to right.
Spaces don't do sht unless you f-ed up somewhere lol.
As for prefix and postfix increments/decrements, they have been discussed for over the past decade. Just search the forum.
+ 1
thanks a lot.
0
"++" and "--" comes after brackets right