Inside File.list(FilenameFilter) calls FilenameFilter.accept(), if filter rule satisfied, file name is add to String[] to be returned. Callback is the way passing function as parameter. C/C++ has pointer while Java don't. So Java's Callback is a fake one. passing function in Java is realized by passing Object reference , Inner anoymous or other delegate object. In this example. passing accept() is realized by passing its owner DirFilter object.
当然这个args[0]要有值的啊
Callback is the way passing function as parameter. C/C++ has pointer while Java don't. So Java's Callback is a fake one. passing function in Java is realized by passing Object reference , Inner anoymous or other delegate object.
In this example. passing accept() is realized by passing its owner DirFilter object.
回调很简单:你具体实现,人家调用,遵守统一接口。类似于windows的钩子,钩子有函数声明的要求,回调有接口的要求