+ 3
Please explain this to me!
I need somebodies help to understand this: int x=4; int y= ++Ă*4/Ă+Ă; system.out.println(x+y); //Outcome is 14 but I dont get how. I appreciate any support. I got it wrong in a challange and I want to know how to solve it properly.
8 Answers
+ 7
Tricky part is paying attention to your order of operations since you aren't using parenthesis. Other than that, just simple math. Don't forget that ++x increments the value before its operation.
x: 4
y = ++x*4 = 20
X: 5
y = 20 / 5 = 4
y = 4 + 5 = 9
x + y = 14
+ 6
what you dont understand?
+ 4
lolol You're absolutely right Gordie. It's early still and I'm lacking my cup of coffee. Thanks for correcting me.
+ 3
lol Will do. The sad part is that I told him not to forget, and my dumb ass forgot immediately after I said that. I'm not sure if coffee can fix stupid. :D
+ 1
sry I had to edit the post
0
Thank you guys, rookie mistake I did after all. Good to know to have some quick responders being part of this community.