Java Path combine two path values by resolving sibling

Description

Java Path combine two path values by resolving sibling

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

public class Main {
  public static void main(String[] args) {
    Path p = Paths.get("c:/a/b/c/d/e/Main.java");

    Path p2 = Paths.get("Main1.java");

    Path re = p.resolveSibling(p2);

    System.out.println(re);/*from   w w w . j a v  a2  s.  c o  m*/

     re = p2.resolveSibling(p);

    System.out.println(re);
  }
}



PreviousNext

Related