Existence of File
This program explains the use of the exists method in the File class.Exists method checks if the file exists in the current directory.
/*
http://www.ProbCOMP.com
This program explains the use of the exists method in the File
class.Exists method checks if the file exists in the current
directory.
*/
import java.io.File;
public class FileExists {
public static void main(String args[])
{
File file = new File(args[0]);
boolean exists = file.exists();
System.out.println(file+"exists: "+exists);
}
}
Download Program


