Java codeimport java.io.*;
public class Csdn1{
public static void main(String[] args) {
BufferedReader bd = null;
BufferedWriter bw = null;
try { bd = new BufferedReader(new FileReader("F:\\sushuai\\23\\a.txt"));
bw = new BufferedWriter(new FileWriter("F:\\sushuai\\23\\b.txt"));
String str1 = null;
StringBuffer str2 = null;
while((str1 = bd.readLine()) != null) {
// System.out.println(str1);
if (str1.length() == 0 ) {
} else if (str1.charAt(0) == '@'){
} else if (str1.charAt(0) == '!') {
str2 = new StringBuffer(str1);
str2.setCharAt(0,'@');
str1 =str2.substring(0);
}
bw.write(str1,0,str1.length());
bw.newLine();
}
bd.close();
bw.close();
}catch(IOException e) {
e.printStackTrace();
}
try {
bd = new BufferedReader(new FileReader("F:\\sushuai\\23\\b.txt"));
bw = new BufferedWriter(new FileWriter("F:\\sushuai\\23\\a.txt"));
String str3 = null;
while((str3 = bd.readLine())!= null) {
bw.write(str3,0,str3.length());
bw.newLine();
}
bd.close();
bw.close();
} catch(IOException e1) {
e1.printStackTrace();
}
}
}
------解决方案--------------------
学习。
LZ 举的例子 太个例了