B
Bill Medland
I just thought I'd check before I make a real fool of myself. Am I right in
deducing that in Java we can't really return multiple primitives from a
method; we need either to cast to objects or else package them in a class?
I am porting an API from C++/COM and from C#/.NET to Java.
The existing API contains a load of functions that return a boolean
success/failure (or sometimes an integer status) and return the information
through pointers in the argument list.
For example (pseudo-language) bool getFiscalQuarter(string y, int p, out int
quarter) returns true if it can be figured out and false otherwise.
My understanding is that Java does not support referencing like this. Is
that correct?
(The solutions I know of are:
1. Return the quarter, throwing an exception if it cannot be figured out
2. Take a java.lang.Integer as an argument and modify it
)
deducing that in Java we can't really return multiple primitives from a
method; we need either to cast to objects or else package them in a class?
I am porting an API from C++/COM and from C#/.NET to Java.
The existing API contains a load of functions that return a boolean
success/failure (or sometimes an integer status) and return the information
through pointers in the argument list.
For example (pseudo-language) bool getFiscalQuarter(string y, int p, out int
quarter) returns true if it can be figured out and false otherwise.
My understanding is that Java does not support referencing like this. Is
that correct?
(The solutions I know of are:
1. Return the quarter, throwing an exception if it cannot be figured out
2. Take a java.lang.Integer as an argument and modify it
)