- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Check whether the file is hidden or not in Java
The method java.io.File.isHidden() is used to check whether the given file specified by the abstract path name is a hidden file in Java. This method returns true if the file specified by the abstract path name is hidden and false otherwise.
A program that demonstrates this is given as follows −
Example
import java.io.File; public class Demo { public static void main(String[] args) { try { File file = new File("demo1.txt"); file.createNewFile(); System.out.println("Is file hidden? " + file.isHidden()); } catch(Exception e) { e.printStackTrace(); } } }
The output of the above program is as follows −
Output
Is file hidden? false
Now let us understand the above program.
The method java.io.File.isHidden() is used to check whether the given file specified by the abstract path name is a hidden file and the boolean value that is returned by the method is printed. A code snippet that demonstrates this is given as follows −
try { File file = new File("demo1.txt"); file.createNewFile(); System.out.println("Is file hidden? " + file.isHidden()); } catch(Exception e) { e.printStackTrace(); }
- Related Articles
- Java Program to check whether a file exists or not
- Check if a file is hidden in Java\n
- Check whether the entered value is whitespace or not in Java
- Determine if File or Directory is hidden in Java
- Check whether a Stack is empty or not in Java
- Check whether a character is Lowercase or not in Java
- Check whether a character is Uppercase or not in Java
- Check whether a HashSet is empty or not in Java
- Check if hidden files are displayed in the FileChooser or not in Java
- Check whether IdentityHashMap empty or not in Java?
- Check whether the entered value is a digit or not in Java
- Check whether the entered value is a letter or not in Java
- Check whether the given file is an existing file in Java
- Check whether a NavigableMap empty or not in Java
- Check if a File is hidden in C#

Advertisements