Java Examples - Determine if a file is hidden
The following example demonstrates using the File class's file.isHidden() method to determine 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 running the above code is (Demo.txt is a hidden file):
TrueOther Extensions
Java Examples