Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.File;

public class Main {
    public static void main(String[] args) {
        File oldName = new File("C:/s.txt");
        File newName = new File("C:/d.txt");

        if (oldName.renameTo(newName)) {
            System.out.println("renamed");
        } else {
            System.out.println("Error");
        }
    }
}