i have 2 class....class A and class B....in class A i want to call a method in class B and send 2 parameter(v1 and v2).....in class B, it will transform v1 and v2 into v3 and v4.....the problem is...i need to send back the 2 new variables(v3 & v4) to class A....we can only return one value.....so, what i can do to send v3 & v4 back to class A???
If v1 and v2 are objects instead of primitives, the easiest solution is an Object array (or a specific array if they have the same class). Here's a trivial example:This will output the following.Does that clarify it? Ben's suggestion is to define a class with fields that will hold the returned objects along with a pair of get/set methods (accessors) for each. This class would satisfy the JavaBean requirements, so you might want to look that up at Sun's Java site if you need examples.