java,
分享于 点击 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(); // 创建文件,根据给定的路径创建
}
}
};
相关文章
- 暂无相关文章
用户点评