import java.io.*;
class FindFile {
public static void main(String[] args) {
File dir = new File("D:/Abhishek/src/com/siemens/med/hs/sf/payer/billing/claiminterface");
FilenameFilter filter = new FilenameFilter() {
public boolean accept
(File dir, String name) {
return name.indexOf("Claim");
}
};
String[] children = dir.list(filter);
if (children == null) {
System.out.println("Either dir does not exist or is not a directory");
}
else {
for (int i=0; i< children.length; i++) {
String filename = children[i];
System.out.println(filename);
}
}
}
}
答案 0 :(得分:1)
我认为你的意思更像是
return name.toLowerCase().indexOf("claim") > -1;
在FileFilter
班级......