Java class 文件系统和文件系统,它们有什么区别?什么时候使用一个而不是另一个?
Java class FileSystem & FileSystems, what is the difference between them? When to use one over the other?
我是 Java 的新手,正在尝试学习 IO 的概念。我遇到过两个非常相似的Java 类,FileSystem和FileSystems。它们之间有什么区别?什么时候使用一个而不是另一个?
FileSystems
is an utility class/factory that is only used to get instances of FileSystem
. Refer to the class documentation 用于 FileSystems
class.
中的方法
基本上,除非您想获得 FileSystem
的实例,否则您永远不会使用 FileSystems
。对于所有其他用例,您只想使用 FileSystem
.
我是 Java 的新手,正在尝试学习 IO 的概念。我遇到过两个非常相似的Java 类,FileSystem和FileSystems。它们之间有什么区别?什么时候使用一个而不是另一个?
FileSystems
is an utility class/factory that is only used to get instances of FileSystem
. Refer to the class documentation 用于 FileSystems
class.
基本上,除非您想获得 FileSystem
的实例,否则您永远不会使用 FileSystems
。对于所有其他用例,您只想使用 FileSystem
.