// 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:
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/jgloss/multiplereturn.html | J:\mindprod\jgloss\multiplereturn.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.101] | |
| Feedback | You are visitor number 12,970. | |