Java tutorial
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"); } } }