check whether file exists in java

www‮ual.‬tturi.com
check whether file exists in java
/**
 * @author lautturi.com 
 * Java example:
 */
import java.io.File;

public class Lautturi {
	
	public static void main(String[] args) {
		// File tempFile = new File("c:\\temp\\temp.txt");
		File tempFile = new File("c:/temp/temp.txt");
		boolean exists = tempFile.exists();
		if(exists) {
			// file exists
		}
	}
}
Created Time:2017-09-23 14:34:29  Author:lautturi