Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: improvise LatchCounter Date: Wed, 14 Sep 2011 09:44:38 -0700 Organization: A noiseless patient Spider Lines: 26 Message-ID: References: <3866cb2e-c182-47ce-b03a-33ec8d906f67@glegroupsg2000goo.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 14 Sep 2011 16:44:41 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="23580"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/25RRR5uGPV4xe5rKl1M4vDIckavJhiyA=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: <3866cb2e-c182-47ce-b03a-33ec8d906f67@glegroupsg2000goo.googlegroups.com> Cancel-Lock: sha1:S+nJ9DnKXtQoqpU4HnnpiTARM24= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8024 On 9/13/2011 10:40 PM, Asit Dhal wrote: > Here, I have made a small utility class which sorts the sample data. > I want to generalize the class by means of an external > function(something like call back function). Please suggest me how to > do this ? Normally in Java you make a callback with an interface public interface Sort { void sort(); } Then provide implementations for it: public class BubbleSort implements Sort { public void sort() { .. sort here with bubble method.. } } If you can be more specific what you are trying to do, it might help us answer your question better.