Creating a path between two paths in Java using the Path class

后端 未结 4 1974
梦如初夏
梦如初夏 2020-12-11 15:05

What does exactly mean this sentence from this oracle java tutorial:

A relative path cannot be constructed if only one of the paths includes a root

4条回答
  •  既然无缘
    2020-12-11 16:03

    System dependent here refers to the specific OS implementation I would assume. So Linux will handle this differently than Windows will, etc. Without root paths (i.e. paths starting with /), both paths are assumed to be siblings, sitting on the same level (i.e. in /home/sally). So when you try to relativize, if they are not on the same level, there is no guarantee where the non-root path is stored, which makes sense if you think about it. Does that help?

提交回复
热议问题