java判断目录是否存在用什么函数... 最近用到... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 File isDirectory() 这个就OK File file = new File(".");System.out.println("File isExist: " +file.exists()); String path="你的路径";File file = new File(path);boolean b = file.isDirectory(); File exists()File isDirectory() isDirectory()文件存在且为一个目录时返回true He wants to know whether the file exists or not...So:if ((yourFile.isDirectory()) && (yourFile.exists())) File file = new File(path); if (!file.exists()) { System.err.println("文件不存在"); file.createNewFile();// 不存在则创建 System.err.println("文件创建"); } File类:boolean exists() //文件或者是目录存在boolean isDirectory() //File是否是目录boolean isFile() //File是否是文件查File类API file.exists()这个是file一个方法?? 空指针 关于usebean的问题 帮忙解释下这是什么 异常 熟悉Crystal reports for eclipse 的朋友请进,数据源问题. 问几个常见的面试问题,大家发表一下意见! 急求swing的一段代码,跪求高手帮忙~!! 关于java代码一些代码不理解的地方 帮我调个小程序 JavaMail怎么收邮件? 高手请看过来,我有些问题,我是新手.关于线程的! 关于集合,对象的问题 大家来讨论下这个面试题
这个就OK
File file = new File(".");
System.out.println("File isExist: " +file.exists());
String path="你的路径";
File file = new File(path);
boolean b = file.isDirectory();
File isDirectory()
文件存在且为一个目录时返回true
He wants to know whether the file exists or not...
So:if ((yourFile.isDirectory()) && (yourFile.exists()))
File file = new File(path);
if (!file.exists())
{
System.err.println("文件不存在");
file.createNewFile();// 不存在则创建
System.err.println("文件创建");
}
boolean exists() //文件或者是目录存在
boolean isDirectory() //File是否是目录
boolean isFile() //File是否是文件查File类API
这个是file一个方法??