Java Path.resolve(Path other)

Syntax

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

Path resolve(Path other)

Example

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


//from   w w  w .j  a v a  2s.  c o  m
import java.nio.file.Path;
import java.nio.file.Paths;

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.resolve(path1).normalize());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.file »




DirectoryStream.Filter
Files
FileStore
FileSystem
FileVisitor
Path
Paths
WatchService