您的位置:首页 > 编程语言

io流操作之文件重命名代码

2015-12-13 20:48 246 查看
import java.io.File;

public class TestFile {
public static void main(String[] args){

File file1 = new File("D:\\io\\helloworld.txt");
System.out.println(file1.getAbsoluteFile());
File file2 = new File("D:\\io\\hello2.txt");
//rename()方法要求file1一定存在,file2一定不存在
Boolean b = file1.renameTo(file2);
System.out.println(b);

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  io流