Getting results from method arguments???

In the C/C++ world, one can get results back from function arguments so I can do the following in C++: void func(int& x, float* y) { x = 1000; *y = 1.22; } In Java, there does not seem to be any straight forward way of assigning values to primitive types and returning them via method arguments (kinda unfortunate that Integer, Float objects are immutable). Probaby one way of doing this is to create a 'helper' object eg public class Helper { public int anInt; public float aFloat; } and pass it into the method: void func(Helper x) { x.aInt = 1000; x.aFloat = 1.22; }

or even: Helper func() { Helper x = new Helper(); x.aInt = 1000; x.aFloat = 1.22; return x; } Is this a common way of doing things or are there any 'standard' ways?

That's a fairly common way. It makes the most sense if the values are somehow related in such a way that there is some logical name for the class which contains them. For example, if you want to return the x, y, z coordinates of a point in space, it makes sense to define a class: <code><pre>class 3DCoordinate { double x; double y; double z; }</pre></code> ...especially if you anticipate needing to use those variables together in other situations. You can also use pre-existing container objects such as arrays and Vectors. Your original func(int& x, float* y) example can be mimicked by: <code><pre> void func(int[] xHolder, float[] yHolder) { xHolder[0] = 1000; yHolder[0] = 1.22f; }</pre></code> Calling this is a little strange: <code><pre> int[] X = new int[1]; float[] Y = new float[1]; func(X, Y); int x = X[0]; float y = Y[0]; </pre></code> That's just one of many possibilities though - most others are strange too. The best bet is probably to go with the first idea, and extend it by grouping the method func() with the data it operates on, as part of the same class: <code><pre>class ValueFinder { public int x; public float y; public void func() { x = 1000; y = 1.22f; } }</pre></code> Then you get the values later from outside this class like so: <code><pre> ValueFinder vf = new ValueFinder(); vf.func(); int x = vf.x; float y = vf.y; </pre></code> A more complete example: <code><pre>class Calculator { private int a; // an input private int b; // an input private int c; // an input

public class Test { public static void main(String[]) { Calculator calc = new Calculator(); calc.setA(635); calc.setB(571); calc.setC(549); calc.calculate(); int x = calc.getX(); int y = calc.getY(); } }</pre></code> This is a fairly typical Java idiom. It may seem like a lot of extra code overhead compared to C/C++, but if the values a, b, c, x, and y are actually related and are used together with any frequency, it can be fairly useful and readable. Though it's nowhere near as elegant-looking as Perl's lists, or Python's tuples, IMO. But we do what we can with what we have.

"I'm not back." - Bill Harding, Twister

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com