aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes What is a callback method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "What is a callback method? " Watch "What is a callback method? " New topic
Author

What is a callback method?

Rahul Jadaun
Ranch Hand

Joined: Oct 05, 2006
Posts: 36
What is a callback method?
Rohitt Vermaa
Ranch Hand

Joined: Oct 12, 2006
Posts: 232
Callback method is a method intended to be passed as a parameter. The callee can then call the passed method. Callbacks are often used in event handling code. This has nothing to do with SCWCD.


SCJP ,SCWCD
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
This has nothing to do with SCWCD

in fact, see the first question of the filters mock test in HFSJ,
it has a question on it !


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Tim Lawrence
Greenhorn

Joined: Aug 30, 2004
Posts: 1
Hi, I am also interested in understanding more about callback methods. Could someone please explain what a "container callback method" is as opposed to an "inline method"? (As Niranjan points out) both of these concepts appear in the answer to the first test question of HFSJ Chapter 13 on filters (pg.700).

"doFilter() is both a callback and an inline method" - what does that mean?

regards

Tim
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Rohitt's answer is interesting, but methods cannot be passed as a parameter in Java. That is a feature of some other languages like JavaScript and Ruby.

Searching this forum with the keyword "callback" returns many, many results.

One of my previous answers was here .


A good workman is known by his tools.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9524
    
    2

Method passed as a parameter?? The first time I'm hearing this!


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42644
    
  65
Method passed as a parameter?? The first time I'm hearing this!


Don't feel bad about it

As Marc says, Java doesn't have this, but other languages do, e.g. C has had this for a long time.

It is of course possible in Java to define an interface that has only a single method, and use that as the callback, which would be pretty close.


Ping & DNS - my free Android networking tools app
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The good old days with pointers to functions
Something similar could also be done with Reflection.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is a callback method?