zoukankan      html  css  js  c++  java
  • Java数据流之File

      @Test
        public  void fileTest() {
            //创建File 对象
            File file=new File("hell.txt");
            //获取文件名
            System.out.println(file.getName());
            //访问文件的绝对路径
            System.out.println(file.getAbsolutePath());
            //为文件对象重命名
            file.renameTo(new File("hellWord.txt"));
            //判断文件是否真的存在
            if(!file.exists()){
                try {
                    //如果不存在,创建
                    file.createNewFile();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            System.out.println(file.getName());
            System.out.println("古典风格公司");
            
        }

  • 相关阅读:
    JavaScript事件处理
    JavaScript模拟"类"的三种方法
    非构造函数的继承和拷贝
    构造函数的继承
    vim开发环境
    socket之非阻塞
    网络编程
    多线程
    消息队列
    信号
  • 原文地址:https://www.cnblogs.com/liuquande/p/3790363.html
Copyright © 2011-2022 走看看