提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
结合使用isReadable(),isWritable()和isExecutable()方法
import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path;/* from NowJava.com - 时 代 Java*/ public class Main { public static void main(String[] args) { Path path = FileSystems.getDefault().getPath( "C:/folder1/folder2/folder4", "test2.txt"); boolean is_accessible = Files.isRegularFile(path) & Files.isReadable(path) & Files.isExecutable(path) & Files.isWritable(path); if (is_accessible) { System.out.println(