Posted: Tue May 17, 2005 7:43 pm Post subject: returning multiple values
when i have written a method and want it to return multiple values to the method that called it how do i do it? the only way i know so far is in the method that is doing the calling write a line like;
variable = methodName ();
and in method name:
public boolean methodName ()
{
return true;
}
but this can only return one variable at a time...
Sponsor Sponsor
wtd
Posted: Tue May 17, 2005 8:04 pm Post subject: (No subject)
You either have to return an array, or some other collection or write a class yourself that wraps several values.
Something like:
Java:
class Pair<T1, T2>
{ private T1 val1;
private T2 val2;