Sample Programs

Sample java program to find if the file is hidden


 package org.jusfortechies.example; 

 import java.io.File;
 import java.io.IOException;
 
 public class FileHidden {

   public static void main(String[] args) {
      
      try {
         File file = new File("C:\\samplefile.txt");

         file.createNewFile();

         // Check whether the file is hidden.
         if (file.isHidden()) {
            System.out.println("File is hidden");
         } else {
            System.out.println("File is not hidden");
         }

      } catch (IOException ie) {
         System.err.println("Exception occured : " + ie);
      }

   }

 }




blog comments powered by Disqus