Java中 IO类

package com.hxzy.IOSer;
import java.io.*;
public class Demo05 {

public static void main(String[] args) throws Exception{
Gu_3();
}
/*3..
* File类的判断功能
* boolean isFile()
* 判断封装在File 构造方法中的参数 是否是文件
* 如果是文件夹返回true 如果不是或者不存在 返回false
*
* */
public static void Gu_3() {
File file = new File("E:/G");
System.out.println(file.isFile());
}

/*2..
* File类的判断功能
* boolean IsDirectiry()
* 判断封装在File 构造方法中的参数 是否是文件夹
* 如果是文件夹返回true 如果不是或者不存在 返回false
* */
public static void Gu_2() {
File file = new File("E:/G");
System.out.println(file.isDirectory());
}


/*1...
* Flie 类的判断功能
* boolean exists()
* 功能:判断File类中构造方法封装的路径是否存在
* */
public static void Gu_1() throws Exception {
File file = new File("E:G/gubin/yxx/yxx.txt/s");
System.out.println(file.exists()); //判断结果为true

}
}

原文地址:https://www.cnblogs.com/gu-bin/p/10038352.html