Here you can find the source of reName(String s, String s1)
public static final void reName(String s, String s1)
//package com.java2s; /*/*ww w.j a v a 2 s.c om*/ * Copyright 2014-2024 the https://github.com/xiaoxing598/itganhuo. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * This project consists of JAVA private school online learning community group Friends co-creator [QQ group 329232140]. * ????JAVA???????????????????[QQ?329232140]; * See the list of IT dry technology sharing network [http://www.itganhuo.cn/teams]. * ???????????IT???????[http://www.itganhuo.cn/teams]; * The author does not guarantee the quality of the project and its stability, reliability, and security does not bear any responsibility. * ?????????????????????????????????????????. */ import java.io.File; public class Main { public static final void reName(String s, String s1) { File file1 = new File(s); if (file1.exists()) { file1.renameTo(new File(s1)); } } }