Java examples for File Path IO:Path
Get the Path File/Directory Name
import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path path = Paths.get("C:", "folder1/folder2/folder4", "test.txt"); //from w ww . j a v a 2s .co m System.out.println("The file/directory indicated by path: " + path.getFileName()); } }