+ 1

Please check if I am right, maybe you have a mistake in lesson

In Java course Classes and Objects => Value & Reference Types => 1st example in tutorial you wrote that the code outputs 5, but I think it's 6.

21st Dec 2017, 4:18 PM
Володимир Янковський
Володимир Янковський - avatar
1 Resposta
+ 1
5 is correct Because you're passing it as by value, not by reference, so when you add one, you're not affecting x, so 5 is the output. 6 would be the output if you outputted the "num" variable.
21st Dec 2017, 4:37 PM
Hassie
Hassie - avatar