Get the Path Parent - Java File Path IO

Java examples for File Path IO:Path

Description

Get the Path Parent

Demo Code

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 . ja  v a 2  s  .  c  o  m*/
        System.out.println("Parent: " + path.getParent());
    }
}

Related Tutorials