Java-基础 文件操作IO 重命名文件

来源:互联网 发布:php经常用的代码 编辑:程序博客网 时间:2024/05/16 06:49
public static void main(String[] args) {
        File oldName = new File("C:/LC.txt");
        File newName = new File("C:/lc.txt");
        if(oldName.renameTo(newName)) {
            System.out.println("已重命名");
        } else {
            System.out.println("Error");
        }
    }

0 0
原创粉丝点击