How do I know if there is a file before I read it in Java? In Pearl, you know when you say -e $filename.
I looked it up and asked how to check if there is a file when writing a file, and I told you to use FileWriter
I think what I want is a little different when I read it
Readable
Is there a way to make an exception if there is no file open and return the existence of the file as true/false?
java file-io io
Write java.io.File.
File f = new File(filePathString);
if(f.exists() && !f.isDirectory()) {
// // do something
}
© 2024 OneMinuteCode. All rights reserved.