zoukankan      html  css  js  c++  java
  • File 类的应用

    1. 获取文件的绝对路径:

    package com.xuzhiwen.io;
    
    import java.io.File;
    import java.io.IOException;
    
    public class CreateFile {
        public static void main(String[] args) throws IOException {
            File file = new File("test.txt");
            if(!file.exists()){
                file.createNewFile();
                System.out.println("create success");
            }
            String path = file.getAbsolutePath();
            System.out.println("绝对路径:"+path);
        }
    }

    2.抽象类不能被实例化,必须生成子类后才能实现一定的功能。

  • 相关阅读:
    Codeforces 1072
    XDOJ 1046
    BZOJ 1002
    BZOJ 1001
    BZOJ 1500/Luogu 2042
    nowcoder 211B
    BZOJ 3224
    BZOJ 1150
    POJ 2442
    二叉堆和二叉搜索树进阶
  • 原文地址:https://www.cnblogs.com/beibidewomen/p/7357764.html
Copyright © 2011-2022 走看看