It is used to pass a object to a method as an argument. Method inturn can invoke other methods associated with the Object passed to it as an argument.
Callback technique is essentialy used in scenarios where user wants to invoke different methods without leeting client know which method of which class is being invoked.
Java use interfaces for callbacks mechanism. In this case, a method holds an interface reference in its argument list and then invokes a method in the interface.
java.io.Serializable Interface is one such example from Java API.
Now the million dollar Question - Why on this Planet do we want a callback? When we pass a parameter, method being invoked gets the information (ie parameter value etc). What is returned is a result primitive or Object which provides only meager flow of info. Callback mechanism however allows a two-way communication channel between caller and callee.
Visitor Pattern is a classic example to demonstrate how Callback technique should ideally be used
~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"