This example changes the name of the file.

Java Code:
import java.io.File;

public class FileRenameExp {

	public static void main(String[] args) {
		File file = new File("C:\\MyFile.txt");
		File newFile = new File("C:\\NewFile.txt");
		file.renameTo(newFile);

	}

}