确定文件或目录是否存在
import java.io.*; /* 来 自* n o w j a v a . c o m - 时 代 Java */ public class Main { public static void main(String[] args) { File file = new File("C:/Folder/Demo.txt"); boolean blnExists = file.exists(); System.out.println("Does file " + file.getPath() + " exist ?: " + blnExists); } }