title: 【学习之路】File类的使用
draft: true
tags:
- 学习之路
- Java
- IO流
categories: - JavaSE
- IO流
description: File类的使用
cover: ‘https://cdn.jsdelivr.net/gh/CodeZixuan/Blog_Images/File/bg.jpg‘
abbrlink: c775efe
date: 2021-04-04 14:16:50
File类的实列化
// 构造器 相对路径File file1 = new File("hello.txt");// 绝对路径File file2 = new File("D:\\java-code\\JavaSETest\\src\\com\\zixuan\\conf\\hello.txt");System.out.println(file1);System.out.println(file2);// 构造器二 以第一个参数parent为父路径,child为子路径File file3 = new File("D:\\io", "testIO");System.out.println(file3);// 构造器三 根据父类File对象和子类路径创建file对象File file4 = new File(file3, "hello.txt");System.out.println(file4);
File类的常用方法

File遍历目录

File重命名指定文件

File文件状态

File删除创建功能

