Rename File in Java


Lumayan buat dokumentasi pribadi😀. It is, java code..

import java.io.File;
import java.io.IOException;

public class Rename{
   public static void main (String args[]) throws IOException{
     File oldFile = new File("OLD.txt");
     oldFile.renameTo(new File("NEW.txt"));
  }
}

Note:
Pastikan program java ini berada satu folder dengan file yang akan direname

compile: javac Rename.java

running: java Rename

About windupurnomo

I'm interested in programming. I am active with several programming such as Java, C #, C, JavaScript, HTML. I'm also develop desktop application (Java Swing), Mobile Application (Android), and Web programming (ASP MVC).
This entry was posted in Java and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s