gpt4 book ai didi

java.nio.file.Path 与 sun.nio.fs.UnixPath

转载 作者:行者123 更新时间:2023-11-30 07:00:40 27 4
gpt4 key购买 nike

我的 Java 代码中几乎所有文件 I/O 操作都使用 java.nio.*。然而,在今天调试一段代码时,我注意到调试器 (Intellij IDEA 14) 显示了以下关于 java.nio.file.Path 实例的信息:

debugger-screenshot

为什么 java.nio.file.Path 对象在调试器中显示为 sun.nio.fs.UnixPath 对象?这两个类有什么区别?

最佳答案

java.nio.file.Path 是一个接口(interface),sun.nio.fs.UnixPath 是它在您的环境中的具体实现。例如,如果您在 Windows 上运行代码,您会看到 sun.nio.fs.WindowsPath

关于java.nio.file.Path 与 sun.nio.fs.UnixPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30367746/

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