Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: blmblm@myrealbox.com Newsgroups: comp.lang.java.programmer Subject: Re: Passing a Method Name to a Method Date: 23 Jun 2011 17:53:19 GMT Organization: None Lines: 34 Message-ID: <96hcsfFf52U2@mid.individual.net> References: <81h4075t4gfjglji1n033rb20025ebho68@4ax.com> X-Trace: individual.net kBGtzHDCGQiX7ezsuXXj+Q0XiTm/jAoFJSRjTmK38V1rcK+7TE X-Orig-Path: not-for-mail Cancel-Lock: sha1:G7v7zdfMbRynuZEswvYpa04OkLc= X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5593 In article , Eric Sosman wrote: > On 6/22/2011 3:46 PM, Gene Wirchenko wrote: > > Dear Jav'ers: > > > > Maybe I will find this after searching more, but so far, no good. > > > > I want to pass a parameter of a method name to another method. > > > > N.B.: I do not want to pass the method name as a string. I want > > to pass it as a pointer / reference / whatever term is used for this > > in Java. > > (It's "reference." The only data items a Java program can > manipulate are primitives and references.) > > Pass a reference to an object that implements an agreed-upon > interface. See, for example, the two-argument version of > java.util.Arrays.sort(). Sound advice IMO -- if you're familiar with the C library function qsort, with its function-pointer parameter, comparing it with the two-argument version of Arrays.sort may be helpful, since IMO they provide roughly equivalent functionality, and a compare-and-contrast with something familiar might be easier to grok than suggestions that might be a little over the head of a novice (no offense to Gene). In the long term learning good object-oriented design is probably a good thing, but in the short term .... [ snip ] -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.