change variable given as argument to function
in pascal I can do this...
Code:
procedure addTen(var num: integer);
begin
num := num + 10;
end;
//(in the main function somewhere...)
var i: integer;
begin
i := 5;
addTen(i);
// i will now have 15 in it
end;
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.
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:
addTen(i);
How can I do the same in java?