+ 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.
1 Answer
+ 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.