BufferedWriter: write(String str)
import java.io.BufferedWriter;
import java.io.FileWriter;
public class MainClass {
public static void main(String args[]) {
try {
FileWriter fw = new FileWriter(args[0]);
BufferedWriter bw = new BufferedWriter(fw);
for(int i = 0; i < 12; i++) {
bw.write("Line " + i + "\n");
}
bw.close();
}
catch(Exception e) {
System.out.println("Exception: " + e);
}
}
}
Home
Java Book
File Stream
Java Book
File Stream
BufferedWriter:
- BufferedWriter
- BufferedWriter: close()
- BufferedWriter: flush()
- BufferedWriter: write(String str)
- BufferedWriter: write(String s, int off, int len)