import java.io.File;
import java.io.IOException;
public class MyClass {
public static void main(String[] args) throws IOException {
try {
File file = new File("d://data.txt");
boolean fileExists = file.exists();
if (fileExists) {
System.out.println("file exists");
} else {
System.out.println("file not exists");
}
} catch (Exception e) {
System.out.print(e);
}
}
}
/*
run:
file exists
*/