gpt4 book ai didi

java - 为什么 getCanonicalPath 会抛出已检查的异常而 getAbsolutePath 不会?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:49:36 30 4
gpt4 key购买 nike

通过阅读一些相关的文字,我知道了两者之间的区别。但我很好奇为什么 getCanonicalPath() 会抛出已检查的异常,而 getAbsolutePath() 不会抛出任何异常?

最佳答案

But I am curious that why getCanonicalPath() throws checked exception while getAbsolutePath() does not throw any?

它说明了为什么在 the documentation for getCanonicalPath 中:

IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries

关于java - 为什么 getCanonicalPath 会抛出已检查的异常而 getAbsolutePath 不会?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7378913/

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