文件操作实例
来源:互联网 发布:win10梦幻桌面软件 编辑:程序博客网 时间:2024/05/19 02:18
import java.io.File ;
import java.io.IOException ;
public class Test{
public static void main(String[] args){
String path = "d:" + File.separator + "Test" ;
File f = new File(path) ;
if(f.exists()){
f.delete() ;
}else{
try{
f.createNewFile() ;
}catch(IOException e){
e.printStackTrace() ;
}
}
String path1 = "d:" + File.separator ;
File f1 = new File(path1) ;
String[] str = f1.list() ;
for(int i = 0 ; i < str.length ; i++){
System.out.println(str[i]) ;
}
File[] file = f1.listFiles() ;
for(int i = 0 ; i < file.length ; i++){
System.out.println(file[i]) ;
}
System.out.println(File.pathSeparator) ;
System.out.println(File.separator) ;
}
}
0 0
- Java文件操作实例
- 文件操作实例
- 文件映射操作实例
- ios 文件操作实例
- python文件操作实例
- 文件操作实例
- php 文件操作实例
- 文件操作实例
- VB操作文件实例
- 文件操作实例-加密文件
- C++简单文件操作实例
- 低级文件操作实例代码
- java文件读写操作实例
- 批处理实例之一:文件操作
- Java文件操作实例浅析
- PHP 读写文件操作实例
- C# Ini文件操作实例
- JAVA文件操作(实例)
- 五子棋程序键盘初始化/打印输出
- 文件复制
- 文件操作十二行
- 文件内容操作九行
- sublime text2 配置成golang IDE
- 文件操作实例
- 字节流
- sed 简明教程
- 将博客搬至CSDN
- Linux平台weblogic集群安装(二)
- goldengate ogg的拆分和合并
- Python3 mysql数据库操作
- 搭建个人博客 方式1 使用Hexo
- 干净轻爽的View Controllers