The File
(and other classes in java.io.*
are rather old, going back to the early days of Java. They work and they do the job, but they aren't easy to use. The File
class itself is an encapsulation of a file's filesystem path in addition to certain metadata (read-only status, file size).
Many Java IO operations and classes, such as FileInputStream
work with the old File
class, but most of them also accept filenames as String
instances.
The Path
class is a better-designed and modern alternative. You can read up about it here: http://openjdk.java.net/projects/nio/javadoc/java/nio/file/Path.html
While Path
is new, the File
class is not officially deprecated or obsoleted. I think it's one of those "if it's a new project, use X, otherwise keep on using Y"-things.
So in response to your question: no, they are not the same. Path
replaces File
and should be used in new projects.