File.canRead()give you authority to you to check file is readable or not. See below example:

import java.io.File;

public class Readable {
public static void main(String[] args) {

File readable = new File(“file_path/test.txt”);

// returns true if the file can be read
boolean bool = readable.canRead();

System.out.print(“Read: ” + bool);

}
}

Result: – Read: false

Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.