gistfile1.txt package day19;import java.io.File;import java.io.IOException;/** * 描述: * 判断功能 * 1、public boolean isDirectory():判断是否为目录 * 2、public boolean isFile():判断是否为文件 * 3、public boolean ex
package day19; import java.io.File; import java.io.IOException; /** * 描述: * 判断功能 * 1、public boolean isDirectory():判断是否为目录 * 2、public boolean isFile():判断是否为文件 * 3、public boolean exists():判断是否存在 * 4、public boolean canRead():判断是否可读 * 5、public boolean canWrite():判断是否可写 * 6、public boolean isHidden():判断是否隐藏 * @outhor 71948 * @create 2017-10-14 9:55 */ public class Demo4_FileMetihod { public static void main(String[] args) { File file1 = new File("D://Test//file1//file1"); try { System.out.println(file1.createNewFile()); } catch (IOException e) { e.printStackTrace(); System.out.println("文件路径有问题"); } // System.out.println(file1.isDirectory()); System.out.println(file1.isFile()); System.out.println(file1.canRead()); System.out.println(file1.canWrite()); System.out.println(file1.isHidden()); } }