package ch10_02;
//省略了import 语句
public class FileTest {
	public static void main(String[] args) throws IOException {
		String  dir="d:/java";
		String fileName="Hello.txt";
		File  f=new File(dir,fileName);
		if(f.exists()){
			boolean b=f.delete();
			if(b){
				System.out.println("成功删除文件："+f.getAbsolutePath());
			}else{
				String out="文件存在，但无法删除文件：";
				System.out.println(out+f.getAbsolutePath());
				System.exit(0);
			}
		}
		boolean b1=f.createNewFile();
		if(b1){System.out.println("成功创建新文件："+f.getAbsolutePath());	}
		else{System.out.println("无法创建新文件！");}
	}
}
