Given the following code
Path p1 = Paths.get("\\photos\\vacation");
Path p2 = Paths.get("\\yellowstone");
System.out.println(p1.isAbsolute()); // false
System.out.println(p2.isAbsolute()); // false
System.out.println(p1.resolve(p2)); // \yellowstone
JavaDoc says:
public abstract Path resolve(Path other)
Resolve the given path against this path.
If the other parameter is an absolute path then this method trivially returns other.
If other is an empty path then this method trivially returns this path.
Otherwise this method considers this path to be a directory and resolves the given path against this path. In the simplest case, the given path does not have a root component, in which case this method joins the given path to this path and returns a resulting path that ends with the given path. Where the given path has a root component then resolution is highly implementation dependent and therefore unspecified.
Running on Windows the paths are not absolute, but its still retuns p2 as a result; I couldnt understand that behaviour. What I am missing?