Java . : Writer Reader . FileWriter FileReader, .
Java
, ( java.io*, , . . ). :
import java.io.*;
main, FileWriter write:
FileWriter writer = new FileWriter("text.txt");
text.txt . - , write() Writer, write() , -:
writer.write(" Java");
, , . throws Exception, main. , write() close(). , .
text.txt, " Java". , "" .
, , - , try - catch ( ). File, ( , . . , , FileWriter).
/ ( FileWriter , , , ), BufferedWriter, FileWriter . flush(), close(), , .
Java
. , ? true FileWriter:
BufferedWriter writer = new BufferedWriter(new FileWriter(myFile, true));
, write(), . :
Java Java Java
- /n write(), . , line.separator System. , lineSeparator, write():
String lineSeparator = System.getProperty("line.separator");
, .
: text.txt " Java".