File isHidden() method in Java with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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() Syntax: file.isHidden() Parameters: This method does not accept any parameter. Return Type The function returns boolean data type representing whether a file is hidden or not Exception: This method throws Security Exception if the write access to the file is denied Below programs illustrates the use of isHidden() function: Example 1: The file "F:\\program.txt" is not hidden Java // Java program to demonstrate // isHidden() method of File Class import java.io.*; public class solution { public static void main(String args[]) { // Get the file File f = new File("F:\\program.txt"); // Check if the specified file // is Hidden or not if (f.isHidden()) System.out.println("File Hidden"); else System.out.println("File Not Hidden"); } } Output: File Hidden Example 2: The file "F:\\program1.txt" is hidden Java // Java program to demonstrate // isHidden() method of File Class import java.io.*; public class solution { public static void main(String args[]) { // Get the file File f = new File("F:\\program1.txt"); // Check if the specified file // is Hidden or not if (f.isHidden()) System.out.println("File Hidden"); else System.out.println("File Not Hidden"); } } Output: File Not Hidden Note: The programs might not run in an online IDE. Please use an offline IDE and set the path of the file. Comment More infoAdvertise with us Next Article File isFile() method in Java with Examples A andrew1234 Follow Improve Article Tags : Java Java-Functions Java-IO package Java-File Class Practice Tags : Java Similar Reads Files isHidden() method in Java with Examples 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 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 Files size() method in Java with Examples size() method of java.nio.file.Files help us to get the size of a file (in bytes). This method returns the file size, in bytes by taking the path of the file as a parameter. The size may differ from the actual size on the file system due to compression, support for sparse files, or other reasons. Th 2 min read Like