본문 바로가기

분류 전체보기68

File I/O : FileWriter 로 내용 추가하기 먼저 코드를 보겠다. import java.io.FileWriter; import java.io.IOException; public class FileWrite { public static void main(String[] args) throws IOException { FileWriter fw2 = new FileWriter("c:/out.txt", true); for(int i=11; i 2021. 4. 2.
File I/O : FileWriter, PrintWriter 이전에 배운 FileOutputStream 의 경우 Byte 단위로 출력해야 한다. 경량의 데이터로 Byte로 출력해야 하는 경우도 있겠지만 보통은 String 이 출력의 대상이 되지 않을까 한다. String으로 출력하는 데는 두 가지 방법이 있다. 먼저 FileWriter. import java.io.FileWriter; import java.io.IOException; public class FileWrite { public static void main(String[] args) throws IOException { FileWriter fw = new FileWriter("c:/out.txt"); for(int i=1; i 2021. 4. 2.
File I/O : FileOutputStream Java를 학습한 지 적어도 4개월이 지난 것 같습니다. 그 중 File I/O에 대한 부분이 기억이 나지 않는데, 앞으로 입사할 회사에서 사용할 것 같은 부분을 개인적으로 공부해보려 합니다. 가장 기초적인 것으로 FileOutputStream을 이용해서 txt파일로 출력해보겠습니다. public class FileTest { public static void main(String[] args) throws IOException { test(); } public static void test() throws IOException{ FileOutputStream out = new FileOutputStream("C:/Users/sksya/Desktop/out.txt"); for (int i = 0; i <.. 2021. 4. 1.
면접 2일차 질문 보호되어 있는 글 입니다. 2021. 3. 30.