最近用到...
解决方案 »
- For语句出现的问题,求指点,谢谢
- sock编程:Exception in thread "main" java.net.BindException:Address already in use
- 春节快乐!关于jdk5.0的Type safety: The cast from Object to HashMap<String,Object> is actually
- args 的问题?大家帮忙看看
- 关于读取文件内容的问题
- 100分,求JTree使用简单问题,在线等待
- String类和StringBuffer的区别?对"String不能变StringBuffer可以改变"理解不清楚
- c#难学吗?
- DataModule中如何执行SQL,判断数据是否存在??小弟是新人
- 什么持久层,数据访问层,各种层。
- 关于集合,对象的问题
- 大家来讨论下这个面试题
这个就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一个方法??