SRL Archive - Java Help and Tutorials

returning things in the params


noidea

2009-11-14 02:08:31

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

2009-11-14 02:21:45

For future reference here is a good article to read up on this: http://javadude.com/articles/passbyvalue.htm



~NS

noidea

2009-11-14 02:47:49

Thanks :)