Sorry if this is completely misplaced, but I'm having a LOT of trouble over a task we got in Java, and I'm wondering whether anyone here oculd help me out?
So basically, my brain is crying over this:
Explain what results you get, and why you get them:
Spoiler for :|:
Can anyone help? I would reaaallly appreciate it. This subject is driving me insane!
What is '++x'
in z=A(++x,B(x,y)); ? I've never seen such an value being passed as an argument. I've only used it as a built in increment method.
My current workstation doens't have java so i just just did this on paper:
-4 (if I ignore that ++ argument)
Did it first by hand, got confused with all the reused variables then ended up using Eclipse as assistant, but still had to tear everything apart.
Anyway, here's how it's executed:
And the ++ before the variable indicates a preincrementation.
The difference between ++var and var++ is this:
tl;dr. Even though I've not programmed in years, I worked them out mentally, and my answer is the same as Renegade: 1, 6, 10
Thank you SO much :D
This is really helpful. I managed to get my head around it (FINALLY) now!
Again, thanks. <3
|All times are GMT -5. The time now is 02:34.|
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.