Java/Excercise

javaio ch03 FileOutputStreamTest1

낭구리 2021. 9. 13. 17:54
package ch03;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileOutputStreamTest1 {

	public static void main(String[] args) {

		try(FileOutputStream fos = new FileOutputStream("output.txt",true)){
			//false 써야 새롭게 덮어쓰는 것을 막아주는
			//true를 쓰면 계속 중복 (덮어쓸수있게 코딩을 할수있게하고싶을때)
			fos.write(65);
			fos.write(66);
			fos.write(67);
			
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println("end");
	}

}

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

javaio ch03 FileOutputStreamTest3  (0) 2021.09.13
javaio ch03 FileOutputStreamTest2  (0) 2021.09.13
javaio ch02 FileInputStreamTest5  (0) 2021.09.13
javaio ch02 FileInputStreamTest4  (0) 2021.09.13
javaio ch02 FileInputStreamTest3  (0) 2021.09.13