Java examples for File Path IO:File Operation
Determine if a file can be read
import java.io.File; public class Main { public static void main(String[] args) { String filePath = "C:/Folder/ReadText.txt"; File file = new File(filePath); if (file.canRead()) { System.out.println("File " + file.getPath() + " can be read"); } else {/*from w ww . j a v a 2 s . c o m*/ System.out.println("File " + file.getPath() + " can not be read"); } } }