AnimeSuki.com Forum

AnimeSuki Forum (http://forums.animesuki.com/index.php)
-   Tech Support (http://forums.animesuki.com/forumdisplay.php?f=24)
-   -   Programming (Java) (http://forums.animesuki.com/showthread.php?t=109773)

Witch of Uncertainty 2012-01-19 13:42

Programming (Java)
 
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!

Paranoid Android 2012-01-19 15:53

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
1
-4 (if I ignore that ++ argument)

Renegade334 2012-01-19 16:09

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:
Spoiler:


And the ++ before the variable indicates a preincrementation.

The difference between ++var and var++ is this:
Spoiler:

larethian 2012-01-19 21:08

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

Witch of Uncertainty 2012-01-20 05:03

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 10:29.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.