- 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.

26th Jan 2017, 8:09 AM
Mubeen Sal
Mubeen Sal - avatar
3 ответов
+ 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.
26th Jan 2017, 8:30 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
thanks a lot.
26th Jan 2017, 8:31 AM
Mubeen Sal
Mubeen Sal - avatar
0
"++" and "--" comes after brackets right
26th Jan 2017, 8:34 AM
Mubeen Sal
Mubeen Sal - avatar