import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
public class Result {
private File result =new File("result.txt");
private FileWriter writer;
private PrintWriter pw;
public Result() {
try {
writer = new FileWriter("result.txt");
pw=new PrintWriter(writer);
}
catch (IOException iox){
System.err.println(iox);
}
}
public void aLine(String in) { //寫入一行
pw.println(in);
}
public void finish() { //關閉輸入流,將文字從緩存寫入文件
try{
pw.flush();
writer.close();
}catch (IOException iox){
System.err.println(iox);
}
}
}