1. public void reNameFile() {  
  2.         File file = new File(   "C:\\folderA\\sample.text");  //注意\\的用法转移字符
  3.         File newFile = new File("C:\\folderB\\sample2.text");  
  4.         boolean reNameOK = file.renameTo(newFile);
  5. }  
  6. C:/folderA下的sample.text被删除了
  7.    

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2021-10-09
  • 2022-12-23
  • 2021-09-29
  • 2022-02-05
  • 2022-12-23
相关资源
相似解决方案