file的绝对路径
file的相对路径
file路径的写法
file的各种方法
File.separator
解决虚拟机和windows路径中的斜杠问题
lambda怎么写
file1 file2 file3 file4
public class FileDemo04 { public static void main(String[] args) { File file = new File("."); File[] files0 = file.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { if (pathname.getName().startsWith(".")){ return true; }else { return false; } } }); File[] files1 = file.listFiles(new Myfile() {}); for (File file1 : files1) { System.out.println(file1); } File[] files2 = file.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().startsWith("."); } }); File[] files3 = file.listFiles((pathname) ->pathname.getName().startsWith(".")); File[] files4 = file.listFiles((pathname)->pathname.getName().startsWith(".")); } } class Myfile implements FileFilter{ @Override public boolean accept(File pathname) { if (pathname.getName().endsWith("a")){ return true; }else { return false; } } }