关于文件的赋值,有些疑问,求解- for (File f : files) {
- FileReader fr = new FileReader(f);
- String dir2name = f.getName().replaceAll("\\.java$$$$", ".txt");//这句不懂,为什么要加双斜杠和$$$$
- FileWriter fw = new FileWriter(new File(dir2, dir2name));
- int len = 0;
- char[] ch = new char[1024];
- while((len=fr.read(ch))!=-1){
- fw.write(ch,0,len);
- }
- }
复制代码 |