Java Path resolve sibling

Description

Java Path resolve sibling

import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
  public static void main(String[] args) {
    Path rootPath = Paths.get("/home/music/");

    Path resolvedPath = rootPath.resolve("tmp/test.java");
    System.out.println("rootPath: " + rootPath);
    System.out.println("resolvedPath: " + resolvedPath);
    System.out.println();//from  w w  w . j  a v  a  2 s . com

    resolvedPath = rootPath.resolveSibling("tmp/test.java");
    System.out.println("rootPath: " + rootPath);
    System.out.println("resolvedPath: " + resolvedPath);
  }

}



PreviousNext

Related