本帖最后由 朱德帅 于 2013-3-27 12:18 编辑
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new FileReader("src/1.txt"));
bw = new BufferedWriter(new FileWriter("src/copy2.txt"));
String line;
while((line = br.readLine())!=null) {
bw.write(line);
bw.newLine();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
if(br!=null)
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
if(bw!=null)
bw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
问:拷贝后看了一下文件的大小,发现1.txt是336byte,而copy2.txt是338byte,为什么?
|