A good example of an application that uses callbacks is a SAX parser that parses an XML document. A SAX parser such as Xerces will define an interface such as ContentHandler the declares methods that are called by the parser each time an event occurs such as the start and end of a document or element. Your application code will implement the interface and then pass your implementation to Xerces. In reponse, Xerces will call your methods each time Xerces detects an event such as start or end of a document or element or any other event.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>