We can check if a file exists or not by using exists() method of File object.
String filePathString = "C:\\test.txt";File f = new File(filePathString); if ( f.exists() ) { System.out.println("File exists."); } else { System.out.println("File does not exist."); }
0 comments:
Post a Comment