In this program, we are going to share Java program to check whether a file is hidden or not. If you are a Java beginner and want to start learning the Java programming, then keep your close attention in this tutorial as I am going to share how to write a Java program to check whether file hidden or not.
Copy the below Java program and execute it with the help of Javac compiler. At the end of this program, We have shared the output of this program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import java.io.*; public class IsHidden { public static void main(String[] args) { File file = new File("C:/javaprograms/test.txt"); boolean blnHidden = file.isHidden(); System.out.println("Is this file " + file.getPath() + " hidden ?: " + blnHidden); } } |
Is this file C:\javaprograms\test.txt hidden ?: true
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: Check if a File is hidden in Java, Determine if File or Directory is hidden, How to check if a File is hidden in Java, How to check if a folder exists, Java programs, Java programs with examples, Java programs with output