Rename a file using Java

前端 未结 14 1074
感情败类
感情败类 2020-11-22 07:54

Can we rename a file say test.txt to test1.txt ?

If test1.txt exists will it rename ?

How do I rename it to the alrea

14条回答
  •  庸人自扰
    2020-11-22 08:03

    As far as I know, renaming a file will not append its contents to that of an existing file with the target name.

    About renaming a file in Java, see the documentation for the renameTo() method in class File.

提交回复
热议问题