首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Java 小效能

2012-11-23 
Java 小功能1. 用checkbox实现单选功能重命名很多文件public static void main(String[] args) throws IOE

Java 小功能
1. 用checkbox实现单选功能



重命名很多文件
public static void main(String[] args) throws IOException {File   fold   =   new File( "D:\\test\"); File[] allFile = fold.listFiles();for (int i = 1; i <= allFile.length; i++) {//System.out.println(allFile[i-1].getAbsolutePath());File   file   =   new File(allFile[i-1].getAbsolutePath());String name =  file.getName().substring(0,file.getName().indexOf("."))+"_建议书"+file.getName().substring(file.getName().indexOf("."), file.getName().length());if(file.exists()){file.renameTo(new File("D:\\test\"+name));}System.out.println("重命名第"+i+"个文件");}System.out.println("重命名 完毕。。。");}

热点排行