Given a file, and we have to check whether file can be read or not using Java program.
In this program, there is a file named "C.txt" which is saved in "E:\" drive in my system, so that path is "E:/C.txt".
To check that file can be read or not, there is a method canRead() of "File" class, it returns 'true' if file can be read or returns 'false' if file cannot be read.
Program to check, file can be read or not in Java
Output