确定文件或目录是否存在
/* 来自 nowjava.com - 时代Java*/ import java.io.File; public class Main { public static void main(String[] args) { boolean exists = (new File("filename")).exists(); if (exists) { // File or directory exists } else { // File or directory does not exist } } }