java判断路径、文件、文件夹是否存在
时间:2021-08-17 14:27:48
收藏:0
阅读:9
import java.io.File;
/**
* 判断指定路径的文件是否存在
*/
public class IsFileExists {
/**
* @param args
*/
public static void main(String[] args) {
File file = new File("D://test//behind.rar");
if (file.exists()) {
System.out.println("文件:" + file.getPath() + "|||||存在");
} else {
System.out.println("文件:" + file.getPath() + "|||||不存在!");
}
}
原文:https://www.cnblogs.com/Ning-Blog/p/15151352.html
评论(0)