Reputation: 10028
I'm new to Java and is trying to learn the concept of IO. I have encountered two Java classes that are very similar, FileSystem and FileSystems. What is the difference between them? When to use one over the other?
Upvotes: 1
Views: 287
Reputation: 8214
FileSystems
is an utility class/factory that is only used to get instances of FileSystem
. Refer to the class documentation for the methods in the FileSystems
class.
Basically, you will never use FileSystems
except when you want to get an instance of FileSystem
. For all other use cases, yo uwould only want to use FileSystem
.
Upvotes: 4