Edwin,
Thanks very much for replying.
I did a bit more research on the net and I found out that my wider requirement, for Multiple Return Values (MRVs) from a function, is a highly contentious issue. Some programmers argue for, some against. In any case, Java doesn't support MRVs.
As you rightly suggest, the preferred way to return MRVs in Java is to create and return a custom object, setting the values in the called function, and then 'getting' those values after returning. This is obviously required for when the return values are of different types.
In my case though, I really wanted 2 integers to be returned so your example using an array is very useful.
Many Thanks,
Tom
Edwin - if you will forgive me for changing the subject to the contents of your tagline, evolution is NOT random. If it were then I wouldn't believe in it either. There are plenty of good books on the subject (try Richard Dawkins) or look up any number of articles on the web (try Wikipedia).
I really don't want to start a discussion on evolution, but to use your own analogy, remember that evolution gives CONSTANT feedback - i.e. the individual lives to breed or it dies. So, your analogy of bashing away at the keyboard would be more accurate if the computer gave you feedback after EVERY keystroke (i.e. if it told you "that's useful" or "that's nonsense"). Only then, and given enough time, could you generate an operating system (and you would need a very very long time).
By the way, some people have achieved similar results. Look up Genetic Algorithms on Wikipedia.
Anyway, thanks again for taking the time to respond. Much appreciated.
Tom
[ October 11, 2006: Message edited by: Tom McCann ]