import java.io.*;
public class TestCollections {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
File f=new File("f:\\test\\day20");
String[] namelist=f.list(new FilenameFilter()
{
public boolean accept(File dir,String name)
{
return name.endsWith(".java") || new File(name).isDirectory();
}
});
for(String name:namelist)
{
System.out.println(name);
}
}
}
|| new File(name).isDirectory()这句话在这里是什么意思,感觉不加这句话结果一样是正确的啊
|