public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter("./mymemo.txt");
String myMemo = "hello\n";
fw.write(myMemo);
fw.close();
PrintWriter pw = new PrintWriter("./printMemo");
myMemo = "hello printWriter";
pw.write(myMemo);
pw.close();
FileWriter fw2 = new FileWriter("./mymemo.txt", true);
fw2.write("안녕하세요!!");
fw2.close();
PrintWriter pw2 = new PrintWriter(new FileWriter("./mymemo.txt", true));
pw2.write("print writer로 이어 쓰기");
pw2.close();
BufferedReader br = new BufferedReader(new FileReader("./mymemo.txt"));
while (true) {
String line = br.readLine();
if (line == null) {
break;
}
System.out.println(line);
}
br.close();
}