Determine If A File Or Directory Is Hidden In Java

LEVEL: Intermediate

Whats in this post?

  1. Code
  2. Output
  3. Background and Explanation of the code

Code


To copy code: Click  View Source “View Source” on the right of this code snippet.


Background and Explanation of the code


This Java example shows how to determine if a particular file or directory is hidden using isHidden method of Java File class.The application will start its execution after looking at the main method.Then create file object. To check whether file or directory denoted by File object is hidden, we use boolean isHidden() method of Java file class. This method returns true if file or directory denoted by File object EXISTS and it is hidden.