How to Check Hidden File in Java?

If you want to check if a file is hidden or not. Then use the below code snippet. The method isHidden() in the File class is used for checking if the file is hidden or not. This is simple utility which is useful when you are working with the File operations.



public class HiddenCheck {
	public static void main(String[] args) throws IOException
    	File file = new File("d:\\CreateFile.txt");

    		System.out.println("This is a hidden file");
    		System.out.println("This file is not hidden");



About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.