package it.FileDemo;
import java.io.File;
import java.io.FilenameFilter;
public class FileDemo01 {
public static void main(String[] args) {
File file=new File("F:\\");
String[] Str=file.list(new FilenameFilter() {
//匿名内部类
@Override
public boolean accept(File dir, String name) {
File file1=new File(dir,name);
boolean flag=file1.isFile();
boolean flag1=name.endsWith(".mp4");
return flag&&flag1;
}
});
for (String s : Str) {
System.out.println(s);
}
}
}
|
|