posted 22 years ago
What I have done in the past is if you have to return more than one primitive value I pass a reference to a Vector or an Object array into the method, wrap the return values in an instance of their wrapper classes and return no value from the method. After the method exists, pull the wrapped values from the Vector or array and get your return values out.
String a = "Hello";
int b = 1;
Vector v = new Vector();
hello(a, b, v);
a = (String)v.elementAt(0);
Integer iVal = (Integer)v.elementAt(1);
b = iVal.intValue();
public void hello(String aa, int bb, Vector vv){
String xx = aa + "There";
int yy = bb++;
Integer bVal = new Integer(yy);
vv.add(xx);
vv.add(bVal);
}
Hope this helps!
------------------
Brian Hoff
Sun Certified Programmer for the Java� 2 Platform