Nguyễn Trà
New member
How do you check if a file exists or not in Java?
Answer
Check if a file exists in Java
Answer
Check if a file exists in Java
- Example. import java.io.File; public class Main { public static void main(String[] args) { File file = new File(“C:/java.txt”); System.out.println(file.exists()); } }
- Result. The above code sample will produce the following result (if the file “java. …
- Example. …
- Output.