+ 2
What will be the output?
int m = 7, n = 4, p = 2; System.out.println (m -= m/n + (p--) * (p++) ); Please explain it in steps.
4 Respostas
+ 2
m-=expression <=> m = m - (expression)
there is expression = m/n+(p--)*(p++)
+ 2
m=7 n=4 p=2
m = m - ( m/n + (p--)*(p++))
m/n = 7/4 = 1
p-- =(used: 2)(saved to memory: 1)
p++ =(used: 1)(saved to memory: 2)
m = 7- ( 1 + 2*1) = 4
output: 4
+ 2
Abdulaziz, can you please explain why did you put "m/n+(p--)*(p++)" in parenthesis? Does the compiler do that? If yes, why?
Thanks for the time and help :D
+ 1
Got it! Thanks, Abdulaziz :)