You say in the explanation quoting the javadoc:
In your question your paths are:Where this path and the given path do not have a root component, then a relative path can be constructed.
A relative path cannot be constructed if only one of the paths have a root component.
Where both paths have a root component then it is implementation dependent if a relative path can be constructed.
Both p1 and p2 are starting with: "\\".Path p1 = Paths.get("\\personal\\readme.txt");
Path p2 = Paths.get("\\index.html");
Path p3 = p1.relativize(p2);
System.out.println(p3);
then quoting again from the explanation:
And it's true because if you remove "\\" from either of the 2 paths, it's going to throw an exception.A relative path cannot be constructed if only one of the paths have a root component.
However, after it says:
In your question both have "\\" does it imply that it's implementation dependent?Where both paths have a root component then it is implementation dependent if a relative path can be constructed.
Thanks in advance.