java.nio.file.Files 和 java.io.File 的区别?

Raú*_*aúl 5 java file-io nio

与 File 相比, Files 有哪些优势或主要特点?什么时候更喜欢一个?为什么?

编辑:这只是我们世界中的另一个“差异”问题-因此请确保您真的想对它投反对票!

Vim*_*era 5

根据 Java 文档,java.nio.file.Files class consists exclusively of static methods that operate on files, directories, or other types of files. In most cases, the methods defined here will delegate to the associated file system provider to perform the file operations.

然而java.io.File is an abstract representation of file and directory pathnames.


Sum*_*ngh 4

文件

此类仅由对文件、目录或其他类型的文件进行操作的静态方法组成。

但文件是文件和目录路径名的抽象表示

Means Files 类是一个对文件执行操作的实用程序类。