gpt4 book ai didi

Java IO API : how to get into file subdirectory?

转载 作者:行者123 更新时间:2023-12-02 03:31:23 25 4
gpt4 key购买 nike

我有一个文件指向基本目录:

File baseDir = new File("c:\\baseDir");

现在我想“进入子目录”:

File subDir = new File("c:\\baseDir\\subDir");

我只找到了如何通过字符串连接来做到这一点。但是有 API 函数可以完成这项工作吗?

最佳答案

有一个重载构造函数可以达到此目的:

> File(File parent, String child)

Creates a new File instance from a parent abstract pathname and a child pathname string.

关于Java IO API : how to get into file subdirectory?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38036471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com