change variable given as argument to function
in pascal I can do this...
like in the pascal example above I want to be able to (in java) give a function a variable and let it edit that variable as if that function was part of the function that called it. This may sound confusing.
procedure addTen(var num: integer);
num := num + 10;
//(in the main function somewhere...)
var i: integer;
i := 5;
// i will now have 15 in it
to sum up, I don't want to have to do this:
i := addTen(i);// (pascal)
OR IN JAVA:
i = addTen(i);
I want to just do this:
How can I do the same in java?