Path path = Paths.get("C:\\Users\\John\\Documents\\file.txt");
Path path = Paths.get(new URI("file:///C:/Users/John/Documents/file.txt"));
Path parent = Paths.get("C:\\Users\\John\\Documents"); Path child = Paths.get("file.txt"); Path path = parent.resolve(child);This example joins two paths to create a new Path object that represents the file system path "C:\Users\John\Documents\file.txt". These examples are using the java.nio.file.Paths class and are part of the java.nio.file package library.