File 文件类
File 文件类
三种建立对象的方法
File file=new File("E:\\io0803\\demo01.txt");
File file2=new File("E:\\io0803","demo01.txt");
File parent=new File("E:\\io0803");
与系统有关的路径分隔符
System.out.println(File.pathSeparator);
//与系统有关的默认名称分隔符
System.out.println(File.separator);
方法
获取绝对路径
file.getAbsolutePath();
获取路径字符串
file.getPath();
获取文件名
file.getName();
获取文件大小
file.length();
浙公网安备 33010602011771号