How to determine if a file is hidden in Java

1 Answer

0 votes
package javaapplication1;

import java.io.File;
import java.io.IOException;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {

        try {

            File file = new File("d://data.txt");
   
            boolean b = file.isHidden();

            if (b)
                System.out.println("file is hidden");
            else
                System.out.println("file is not hidden");

        } catch (Exception e) {
            System.out.print(e);
        }
    }
}


/*
        
run:
  
file is not hidden
    
 */

 



answered Nov 16, 2016 by avibootz

Related questions

1 answer 157 views
2 answers 208 views
1 answer 151 views
151 views asked Nov 17, 2016 by avibootz
1 answer 171 views
1 answer 165 views
3 answers 151 views
2 answers 207 views
...