0
Why? ( ‘-ωก̀ )
public class MyClass { public static void main(String[ ] args) { int x = 5; addOneTo(x); System.out.println(x); } static void addOneTo(int num) { num = num + 1; } } Why is "5"?
1 Réponse
+ 1
because you're only changing the internal variable of the function addOneTo(int num) that means num, but x remains how it has been