代码实现
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream("a.txt")));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("b.txt")));
String line=null;
while((line=br.readLine())!=null){
StringBuilder sb = new StringBuilder(line);
String s=sb.reverse().toString();
bw.write(s);
bw.newLine();
bw.flush();
}
bw.close();
br.close();
}
} |
|