只需使用
File.getName()
File f = new File("C:\Hello\AnotherFolder\The File Name.PDF");System.out.println(f.getName());使用 String方法 :
File f = new File("C:\Hello\AnotherFolder\The File Name.PDF"); System.out.println(f.getAbsolutePath().substring(f.getAbsolutePath().lastIndexOf("\")+1));


