Files and Directories
The first thing to note when dealing with files and directories in Java is that both files and directories are objects of type file. Don't look for java.io.Directory, cuz it doesn't exist.
The other confusing thing about working with files in Java is that when you create a new object of type java.io.File, you do not actually create a physical file on the file system. You have only created an object that can be used as a file. There are many classes and methods useful for doing this, which we'll look at in a moment, after we get used to dealing with File objects.
Fields
There are a number of fields in the java.io.File class that are useful when working with files and directories:
static String pathSeparator The system-dependent ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access