Java/입출력

Buffer Writer

Bohemian life 2012. 4. 13. 22:56
package com.writer; //bufferd writer 사용

import java.io.FileWriter;
import java.io.IOException;

public class FileWriterEx {
	public static void main(String[] args) {
		FileWriter fw = null;
		try{
			//fw = new FileWriter("fileWriter.txt");
			fw = new FileWriter("fileWrtier.txt",true);
			String message = "안녕하세요 FileWriter 테스트";
			fw.write(message);
		}catch (IOException ioe){
			ioe.printStackTrace();
		}finally{
			try{
				if(fw != null)fw.close();
			}catch(IOException ioe){
				ioe.printStackTrace();
			}
		}
	}

}