java.io.File isHidden()

Description

On this document we will be showing a java example on how to use the isHidden()┬ámethod of File┬áClass. This method┬átests whether the file named by this abstract pathname is a hidden file. The exact definition of hidden is system-dependent. On UNIX systems, a file is considered to be hidden if its name begins with a period character (‘.’). On Microsoft Windows systems, a file is considered to be hidden if it has been marked as such in the filesystem.

Throws:

SecurityException – If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the file

Method Syntax

public boolean isHidden()

Method Argument

Data Type Parameter Description
N/A N/A N/A

Method Returns

This method returns a boolean, true if and only if the file denoted by this abstract pathname is hidden according to the conventions of the underlying platform.

Compatibility

Requires Java 1.0 and up

Java File isHidden() Example

Below is a java code demonstrates the use of isHidden() method of File class. The example presented might be simple however it shows the behaviour of the isHidden() method of File class. We put a check if the file is hidden or not using isHidden() method, the result is evaluated and messages are printed based on it.

Sample Output

Below is the sample output when you run the above example.

java lang File isHidden() example output

Suggested Reading List

References