PDA

View Full Version : returning things in the params



noidea
11-14-2009, 07:08 AM
Well, I'm in a Java class for school. So far its been a pretty good experience.
Many times in an assignment I've wanted to be able to return certain things, without have to make the method actually return something

So for example:
function FindColor(var x, y: Integer; Colour, x1, y1, x2, y2): boolean;

FindColor stores x and y in vars in another method. So Like

procedure test;
var
x, y: Integer;
begin
FindColor(x, y...);
...


So that means it returns a boolean and it gives me x and y!

I would LOVE to find out how to do that in Java. I imagine it wouldn't be hard at all. I just wanted to get the example correct :p

Nadeem
11-14-2009, 07:21 AM
For future reference here is a good article to read up on this: http://javadude.com/articles/passbyvalue.htm



~NS

noidea
11-14-2009, 07:47 AM
Thanks :)