欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

java,

来源: javaer 分享于  点击 16890 次 点评:243

java,


public class FileDemo06 {
	public static void main(String args[]) throws Exception {
		File f = new File("d:" + File.separator + "test.txt"); // 实例化File类的对象  
        if (f.exists()) { // 如果文件存在则删除  
            f.delete(); // 删除文件  
        } else {  
            f.createNewFile(); // 创建文件,根据给定的路径创建  
        }  
	}
};

相关文章

    暂无相关文章
相关栏目:

用户点评