Java Program to Check Whether a File Is Hidden or Not

You are currently viewing Java Program to Check Whether a File Is Hidden or Not

Java program to check whether a file is hidden or not

import java.io.*;

public class IsHidden {
  public static void main(String[] args) { 
    // create file object.
    File file = new File("E:/includehelp.txt");

    // this will check is the file hidden or not.
    boolean blnHidden = file.isHidden();

    // return result in true or false condition.
    System.out.println("Is the file " + file.getPath() + " hidden ?: " + blnHidden);
  }
}

Output

Is the file E:\includehelp.txt hidden ?: false

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply