File writter (Java)
- 代码:
import java.io.*;
import java.util.*;
import java.lang.Integer;
import java.io.PrintWriter;
import java.io.OutputStreamWriter;
public class fileWriter
{
public void ok()throws IOException
{ BufferedWriter out = new BufferedWriter(new FileWriter("output"));
out.write("aString");
out.newLine(); // create a new line in file
out.write("ok");
out.close();
}
public static void main(String args[])throws IOException
{fileWriter f = new fileWriter();
f.ok();
}}