// kludge to return multiple objects from a method. return new Object[] { aString, new Integer( anInt ) }; // The caller then has to unpack. Object[] junk = aMethod(); String aString = (String) junk[0]; int anInt = ((Integer) junk[1]).intValue();The unboxing intValue() is automatic in JDK 1.5+.
The two main reasons not to use this technique are:
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.16] | The information on this page is for non-military use only. | ||
| You are visitor number 3,571. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/multiplereturn.html | J:\mindprod\jgloss\multiplereturn.html | ||