Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

public class Main {

    public static Boolean checkFileExists(final String filePath) {
        File f = getFileObject(filePath);
        try {
            if (f != null && f.exists() && f.isFile()) {
                return true;
            } else {
                return false;
            }
        } finally {
            f = null;
        }
    }

    public static File getFileObject(final String filePath) {
        if (filePath == null || filePath.length() <= 0) {
            return null;
        }
        return new File(filePath);
    }
}