[Techtalk] Java Question

Sue Stones suzo at spin.net.au
Wed Apr 30 13:38:18 UTC 2008


Any Java Gurus out there?

Is it possible to pass a method as argument and return type in Java?  I 
was planning to do then realised I don't know how.  I have passed 
functions as arguments before, but now that I come to it realise it was 
probably in C.

I need to implement an interface (Runnable) where one method (run) is 
different under different circumstances.  Having a separate class which 
deals with the circumstances and returns the correct run method seems 
like the neatest way of solving this, but I can't think what the return 
type would be!  Googling the idea just brings lots of introductory pages 
about method arguments.

sue


More information about the Techtalk mailing list