Reputation: 323
I have assignment to access file system using java program. In that , I want to create file, read file modify file etc (all operation we can do on file and directory as well).
Is there any way we can do using java program / or any api available to do these operations.
Upvotes: 0
Views: 576
Reputation: 26961
Use java.io.File
and java.nio.file.Files
. They don't care about which OS (Operating System)
are you using. Also File
wraps files and folders, check the methods File.isDirectory()
and File.isFile()
.
NOTE: use also File.separator
to standarize and avoid problems between OS
Upvotes: 1