How to check a file is hidden in Java
In Java to check whether a file is hidden in location we can use the below mentioned program. It checks whether the specified file is hidden or not.
It uses the isHidden() method on File object.
Possible Exceptions are IOException and SecurityException.
package com.jobberindia;
import java.io.File;
import java.util.*;
public class HelloWorld {
In Java to check whether a file is hidden in location we can use the below mentioned program. It checks whether the specified file is hidden or not.
It uses the isHidden() method on File object.
Possible Exceptions are IOException and SecurityException.
package com.jobberindia;
import java.io.File;
import java.util.*;
public class HelloWorld {
public static void main(String[] args) {
File file = new File("c:/filename.txt");
if(file.isHidden()){
System.out.println("The file is hidden");
}else{
System.out.println("The file is not hidden");
}
}
}
No comments:
Post a Comment