By: Editorial Staff | Last Updated:
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.
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
Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari View all posts by Editorial Staff
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