// Get the file File f = new File("F:\\program.txt"); // Check if the specified file // Exists or not if (f.exists()) System.out.println("Exists"); else System.out.println("Does not Exists");
File tempFile = new File("c:/temp/temp.txt"); boolean exists = tempFile.exists();
import java.io.File; File tmpDir = new File("/var/tmp"); boolean exists = tmpDir.exists();