Hi, I just started my java class a few weeks ago, I have a question if you guys can help me.
I`m learning about passing arguments, so I have this small code, it works perfect, the output is " 42 84 ", but I didn`t get it. what does it mean when they say the variables that are passed by value can`t change, if after it`s passed it can be multiplied, and changed?
I just want to understand this and be clear about it.
Here is the code:
class Arg
{
public static void main(String[] args)
{
int orig = 42;
Arg x = new Arg();
int y = x.go(orig);
System.out.println(orig + " " + y);
}
int go(int arg)
{
arg = arg * 2;
return arg;
}
}
Thanks