gpt4 book ai didi

java - getAbsolutePath 和 getCanonicalPath 有什么区别

转载 作者:太空狗 更新时间:2023-10-29 22:45:49 27 4
gpt4 key购买 nike

<分区>

Java 新手问题:文件类中的 getAbsolutePath() 和 getcanonicalPath() 有什么不同。我无法从文档中得到含义。在下面的代码中,它们的输出是相同的。

public class copyFile {
public static void main(String[] args) throws IOException {
File inputFile = new File("/home/kit.ho/");
System.out.println("get AbsolutePath");
System.out.println(inputFile.getAbsolutePath());
System.out.println("get CanonicalPath");
System.out.println(inputFile.getCanonicalPath());
}
}

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