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 rename(String srcPath, String dstPath) {
        File srcFile = null;
        File dstFile = null;
        if (srcPath == null || dstPath == null) {
            return false;
        }
        srcFile = new File(srcPath);
        if (!srcFile.exists()) {
            return false;
        }
        dstFile = new File(dstPath);
        srcFile.renameTo(dstFile);
        return true;
    }
}