IO编程__文本文件处理

 

一、代码如下

package www.tainiu.wenjian;

import java.io.File;
import java.io.IOException;

public class aa__FileDuiXiang {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
//		File f= new File("d:\\Test.txt");
//		
//		System.out.println(f.getAbsolutePath());
//		System.out.println(f.length());
		
		File f= new File("d:\\hsp.txt");
		if(!f.exists()) {
			try {f.createNewFile();} catch (IOException e) {e.printStackTrace();}
		}else {
			System.out.println("文本文件已经存在");
		}

	}

}

 

posted @ 2017-10-06 22:18  18513757531  阅读(167)  评论(0)    收藏  举报