Java/Excercise

javaio ch04 FileWriterTest

낭구리 2021. 9. 13. 17:56
package ch04;

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

public class FileWriterTest {

	public static void main(String[] args) {

		try (FileWriter fw = new FileWriter("write.txt")) {

			fw.write('A');
			char buf[] = {'B','C','D','E','F','G'};
			fw.write(buf);
			fw.write("안녕하세요");
			fw.write(buf,1,2);
			
		} catch (IOException e) {
			System.out.println(e);
		}
		System.out.println("출력이 완료되었습니다.");
	}

}

'Java > Excercise' 카테고리의 다른 글

javaio ch05 BufferedStreamTest  (0) 2021.09.13
javaio ch05 InputStreamReaderTest  (0) 2021.09.13
javaio ch03 FileOutputStreamTest3  (0) 2021.09.13
javaio ch03 FileOutputStreamTest2  (0) 2021.09.13
javaio ch03 FileOutputStreamTest1  (0) 2021.09.13