How to check if file is hidden in java?

Below java code shows how to check if file is hidden –

/****************************************************************************************
 * Created on 08-2011 Copyright(c) http://kodehelp.com All Rights Reserved.
 ****************************************************************************************/
package com.kodehelp.javaio;

import java.io.File;

/**
 * Created by http://kodehelp.com
 * Date: 8/27/11
 */
public class IsFileHidden {
    public static void main(String args[]){
        File file = new File("/demo.txt");
        System.out.println(file + (file.isHidden() ? " is" : " is not")+ " hidden");
    }
}

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.