01.
package
com.java.myapp;
02.
03.
import
java.io.File;
04.
import
java.io.FileWriter;
05.
import
java.io.IOException;
06.
07.
08.
public
class
MyClass {
09.
10.
public
static
void
main(String[] args) {
11.
12.
String path =
"C:\\java\\thaicreate.txt"
;
13.
File file =
new
File(path);
14.
15.
FileWriter writer;
16.
try
{
17.
18.
writer =
new
FileWriter(file,
true
);
19.
writer.write(
"Welcome thaicreate.com 1\r\n"
);
20.
writer.write(
"Welcome thaicreate.com 2\r\n"
);
21.
writer.close();
22.
23.
System.out.println(
"Write success!"
);
24.
25.
}
catch
(IOException e) {
26.
27.
e.printStackTrace();
28.
}
29.
30.
}
31.
32.
}