Java IO Tutorial - Java Path.resolveSibling(Path other)








Syntax

Path.resolveSibling(Path other) has the following syntax.

Path resolveSibling(Path other)

Example

In the following code shows how to use Path.resolveSibling(Path other) method.

import java.nio.file.Path;
import java.nio.file.Paths;
/*from  w w  w .j  a  v a 2 s . co  m*/
public class Main {

  public static void main(String[] args) {
     Path path = Paths.get("C:/home/./music/users.txt");
     Path path1 = Paths.get("./music/users.txt");
     System.out.println(path.resolveSibling(path1).normalize());

  }
}

The code above generates the following result.