Create paths using "." and ".." notations - Java File Path IO

Java examples for File Path IO:Path

Description

Create paths using "." and ".." notations

Demo Code

import java.net.URI;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) {
        Path path16 = FileSystems.getDefault().getPath("/folder1/folder2/./folder4", "test.txt").normalize();
        Path path17 = Paths.get("C:/folder1/folder2/folder3/dummy/../test.txt").normalize();
        Path path18 = Paths.get("C:/folder1/folder2/./folder3/dummy/../test.txt").normalize();
    }//from   w  w  w.  ja v  a 2  s.  co m
}

Related Tutorials