aspose file tools*
The moose likes Java in General and the fly likes Java Cookbook :  Providing Callbacks via Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Cookbook :  Providing Callbacks via Interfaces" Watch "Java Cookbook :  Providing Callbacks via Interfaces" New topic
Author

Java Cookbook : Providing Callbacks via Interfaces

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, mr.ian, what do you means by "callback" in chapter9 - object-oriented techniques ? thank you !
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Definitions of Callback Method on the Web:

´┐ŻA method used to return the results of an asynchronous processing call. Typically, methods are called in a synchronous fashion, where the call does not return until the results (i.e., the output or return value) of the call are available. An asynchronous method call returns prior to the results, and then sometime later a callback method is called to return the actual results. The callback method itself contains program statements that are executed in response to the reception of the results. Also referred to as a callback function under the Win32 API. See Event.



A method that is implemented by application code and that is invoked by system code when needed to perform a specific function. Callback methods are never intended to be invoked directly by application code.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Examples are Java Swing Listener classes

http://java.sun.com/docs/books/tutorial/uiswing/events/eventsandcomponents.html

Consider Key Listener class ehich listens for Key events. The implementation class will be registered with some UI component. When a key event occurs for e.g. when key is Pressed, keyPressed method in KeyListener class is called. The method keyPressed is the callback method.

Callback methods are the method which your code does not call but will be invoked by some other code. Hope this helps.


Groovy
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Pradeep Bhat:
Examples are Java Swing Listener classes

http://java.sun.com/docs/books/tutorial/uiswing/events/eventsandcomponents.html

Consider Key Listener class ehich listens for Key events. The implementation class will be registered with some UI component. When a key event occurs for e.g. when key is Pressed, keyPressed method in KeyListener class is called. The method keyPressed is the callback method.

Callback methods are the method which your code does not call but will be invoked by some other code. Hope this helps.


Great explanation, Pradeep... In addition to Swing listener classes, many servlet listener classes and servlet context listeners are also under the title of "callback"...

Just my 2 cents....


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Cookbook : Providing Callbacks via Interfaces