Java Programming
파일출력시 개행문자
tomato13
2010. 10. 25. 10:30
http://blog.naver.com/suncsj?Redirect=Log&logNo=80026144933
FileWriter는 가독성 때문에 "\n"을 지원하지 않는다.,
그래서 파일출력시 줄단위로 출력을 하기 위해서는.,.
BufferedWriter를 사용한다..
예제)
public void StoreFile(String name)
{
try{
File f1 = new File(getPath(),name);
BufferedWriter bw = new BufferedWriter(new FileWriter(f1));
for(int j = 0; j < this.name.length;j++)
{
bw.write(this.name[j]+" "+this.weight[j]);
bw.newLine();
}
bw.flush();
bw.close();
}catch(IOException e){e.getMessage();}
}
[출처] 자바(Java)에서 파일출력시 개행문자|작성자 지지