The java source code presented on this sections shows how to check if file is hidden. This is a no brainer example since it just used the isHidden method of File class under java.lang package.

Check if file is hidden or not in java

There are three possible output of this java source code. There possible output are the following:

  • File is hidden
  • File is not hidden
  • File does not exist
package com.javatutorialhq.tutorial;


public class CheckHidden {

	 * This java sample code shows
	 * how to check if file is hidden
	 * Property of
	 * All Rights Reserved
	 * Version 1.0
	 * 07/01/2012
	public static void main(String[] args) {
		File file = new File("C:\\temp\\test.log");
				System.out.println("File is hidden");
				System.out.println("File is not hidden");
			System.out.println("File does not exist");