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

Java examples for File Path IO:Path


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

Demo Code

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();
    }/* w  ww.j  a v a2  s.  c  o  m*/

Related Tutorials