Search code examples
javafile-ionio

Difference between java.nio.file.Files and java.io.File?


What are the advantages or key features of Files over File ? When to prefer one & why ?

Edit: This is just another 'difference between' question in our world - so be sure that you REALLY want to downvote it!


Solution

  • Files:

    This class consists exclusively of static methods that operate on files, directories, or other types of files.

    But file is an abstract representation of file and directory pathnames

    Means Files class is an utility class to perform operations on file.