Sunday, 11 June 2017

Java Tutorial : Java IO (Java File - How to Check if a file or dir is hidden) ~ foundjava


Click here to watch in Youtube :


FileDemo.java

import java.io.File;

public class FileDemo
{

    public static void main(String[] args)
    {
        File file = new File("D:/eclipse/backup/Java/.git");

        /*
         * Returns: true if and only if the file denoted by
         * this abstract pathname is hidden according to the
         * conventions of the underlying platform
         */
        if (file.isHidden())
        {
            System.out.println("This file is hidden");
        }
        else
        {
            System.out.println("This file is not hidden");
        }
    }

}
Output
This file is hidden
Click the below link to download the code:

CLICK HERE

No comments:

Post a Comment