java怎么判断一个文件是否存在

2025-09-10 09:59:29
推荐回答(1个)
回答1:

//可以这么判断试下
File file=new File(path);
if (file.exists()) {
   file.delete();//如果文件存在 则删除该文件
}