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;
//www.  ja v a  2s  .  c  o 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.





















Home »
  Java Tutorial »
    java.nio.file »




DirectoryStream.Filter
Files
FileStore
FileSystem
FileVisitor
Path
Paths
WatchService