개발/Java

[JAVA] 파일 생성 후 내용 추가하는 법

Hide 2024. 4. 24. 10:53

String fullPath = "D:/java/kkk/test.txt";

String fileInfo = "파일에 들어갈 내용";

// 파일 생성

FileOutputStream fos = new FileOutputStream(fullPath);

// 내용 추가
fos.write(fileInfo.getBytes());