package com.writer;//bufferd writer
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.IOException;
public class BufferedWriterEx {
public static void main(String[] args) {
FileWriter fw = null;
BufferedWriter bw = null;
try{
fw = new FileWriter("bufferWriter.txt");
bw = new BufferedWriter(fw);
bw.write("BufferedWriter 테스트 입니다");
bw.newLine();//줄바꿈
bw.write("안녕하세요"+
//시스템에서 사용하는 개행 문자를 읽옴
System.getProperty("Line.separator")+"카카하하하");
//bw.flush();//close()메소드가 플러시를 대신함 생략가능
}catch(IOException ioe){
ioe.printStackTrace();
}finally{
try{
if(bw != null)bw.close();
if(fw != null)bw.close();
}catch(IOException ioe){
ioe.printStackTrace();
}
}
}
}