Determine if a file is hidden in Java

Whether a file is hidden or not, is filesystem dependent. On Windows, a file is hidden when it has been marked hidden.

Main.java:

import java.io.*;
   
public class Main {
   public static void main(String[] args) {
      System.out.println(new File("Main.java").isHidden());
      System.out.println(new File("c:\io.sys").isHidden());
   }
}

prints out:

true
false