0309_Java IO操作.docVIP

  • 5
  • 0
  • 约2.2万字
  • 约 31页
  • 2016-12-03 发布于河南
  • 举报
0309_Java IO操作

0309_Java IO操作 范例9-1:文件的基本操作 package cn.mldn.demo; import java.io.File; public class TestDemo { public static void main(String[] args) throws Exception { File file = new File(D:\\demo.txt); // 文件的路径 if (file.exists()) { // 文件存在 file.delete(); // 删除文件 } else { // 文件不存在 file.createNewFile(); // 创建新文件 } } } 范例9-2:修改文件分隔符 package cn.mldn.demo; import java.io.File; public class TestDemo { public static void main(String[] args) throws Exception { File file = new File(D: + File.separator + demo.txt); // 文件的路径 if (file.exists()) { // 文件存在 f

文档评论(0)

1亿VIP精品文档

相关文档