Joining paths in Java

后端 未结 6 1144
有刺的猬
有刺的猬 2021-01-30 02:48

In Python I can join two paths with os.path.join:

os.path.join(\"foo\", \"bar\") # => \"foo/bar\"

I\'m trying to

6条回答
  •  佛祖请我去吃肉
    2021-01-30 03:23

    You can do like

    // /root
    Path rootPath = Paths.get("/root");
    // /root/temp
    Path temPath = rootPath.resolve("temp");
    

    A good detailed post is here Path Sample Usecase

提交回复
热议问题