Check if file exists with java



Αξιολόγηση Χρήστη:  / 3
ΧειρότεροΚαλύτερο 
Λεπτομέρειες

Simple code for check if file exist in java :

View source
package com.developerpages.snippets.core;
 
import java.io.File;
 
public class CheckIfFileExists {
    public static void main(String[] args) {
        File file = new File("file.txt");
        boolean exists = file.exists();
        System.out.println("File " + file.getPath() + " exists: " + exists);
    }
 
}


You have no rights to post comments

   

     

© Developerpages