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


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

Please login or Register to submit your answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.