Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java Example – Checking Whether a File Is Hidden

Java Example – Checking Whether a File Is Hidden

Java Examples Java Examples

The following example demonstrates using the file.isHidden() method of the File class to check whether a file is hidden:

Main.java File

import

java

.

io

.

File

;

public

class

Main

{

public

static

void

main

(

String

[

]

args

)

{

File

file

=

new

File

(

"

C:/Demo.txt

"

)

;

System

.

out

.

println

(

file

.

isHidden

(

)

)

;

}

}

The output of the above code is (Demo.txt is a hidden file):



True

Java Examples Java Examples