Java File check if a file is readable
import java.io.File; public class Main { public static void main(String[] args) { String filePath = "Main.txt"; File file = new File(filePath); if (file.canRead()) { System.out.println("readable"); } else {// www .j a va 2s. co m System.out.println("not readable"); } } }