Files isHidden() method in Java with Examples Last Updated : 29 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report isHidden() method of java.nio.file.Files help us to check whether or not a file is hidden. This method return true if the file is considered hidden else it returns false. The exact definition of hidden is platform or provider dependent. On UNIX, for example, a file is considered to be hidden if its name begins with a period character ('.'). On Windows, a file is considered hidden if it isn't a directory and the DOS hidden attribute is set. Depending on the implementation this method may require to access the file system to determine if the file is considered hidden. Syntax: public static boolean isHidden(Path path) throws IOException Parameters: This method accepts a parameter path which is the path to the file to check. Return value: This method returns true if the file is considered hidden. Exception: This method will throw following exceptions: IOException: if an I/O error occurs SecurityException: In the case of the default provider, and a security manager is installed, the checkRead method is invoked to check read access to the file. Below programs illustrate isHidden(Path) method: Program 1: Java // Java program to demonstrate // Files.isHidden() method import java.io.IOException; import java.nio.file.*; public class GFG { public static void main(String[] args) { // create object of Path // This file is not hidden Path path = Paths.get( "D:\\GIT_EWS_PROJECTS\\logger" + "\\src\\logger" + "\\GFG.java"); // check whether this file // is hidden or not boolean result; try { result = Files.isHidden(path); System.out.println("File " + path + " is Hidden = " + result); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Output: Program 2: Java // Java program to demonstrate // Files.isHidden() method import java.io.IOException; import java.nio.file.*; public class GFG { public static void main(String[] args) { // create object of Path // This file is available on windows and // It is hidden. Path path = Paths.get( "D:\\User Aman\\" + "Documents\\MobaXterm\\" + "\\ArrayList.docx"); // check whether this file // is hidden or not boolean result; try { result = Files.isHidden(path); System.out.println("File " + path + " is Hidden = " + result); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Output: Reference: https://docs.oracle.com/javase/10/docs/api/java/nio/file/Files.html#isHidden(java.nio.file.Path) Comment More infoAdvertise with us Next Article Files isHidden() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.nio.file package Java-Files Practice Tags : Java Similar Reads File isHidden() method in Java with Examples The isHidden() function is a part of File class in Java . This function determines whether the is a file or Directory denoted by the abstract filename is Hidden or not.The function returns true if the abstract file path is Hidden else return false. Function signature: public boolean isHidden() Synta 2 min read File isFile() method in Java with Examples The isFile() function is a part of File class in Java. This function determines whether the is a file or Directory denoted by the abstract filename is File or not. The function returns true if the abstract file path is File else returns false. Function signature: public boolean isFile() Syntax: file 2 min read Files isWritable() method in Java with Examples isWritable() method of java.nio.file.Files help us to check whether Java virtual machine has appropriate privileges that would allow it to open this file for writing or not. It means this method test file is writable or not. This method checks that a file exists or not and if file exists then it is 2 min read Files isReadable() method in Java with Examples isReadable() method of java.nio.file.Files help us to check whether Java virtual machine has appropriate privileges that would allow it to open this file for reading or not. This method test file is readable or not. This method checks that a file exists or not and if file exists then it is readable 2 min read FileSystem isOpen() method in Java with Examples The isOpen() method of a FileSystem class is used to return true if file system is open. This method is very helpful to know filesystem is open or not. File systems created by the default provider are always open. Syntax: public abstract boolean isOpen() Parameters: This method accepts nothing. Retu 2 min read Like