Here you can find the source of fileExists(String file)
Parameter | Description |
---|---|
file | The name of a directory or file. |
public static boolean fileExists(String file)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * //from w w w . j av a 2s.c o m * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ import java.io.File; public class Main { /** * TODO: candidate for common * Tests whether a directory or file exists. * @param file The name of a directory or file. * @return True if the file exists. */ public static boolean fileExists(String file) { File f = new File(file); return f.exists(); } }