xxdxxd
March 1st, 2000, 08:56 AM
I want to output some strings to a file, but the result file has nothing in it, what is wrong with the following code? Thanks.
--------------------------------
import java.io.*;
public class testfile {
public static void main(String[] args) {
try{
File outFile=new File("out.txt");
FileWriter out=new FileWriter(outFile);
BufferedWriter pw=new BufferedWriter(out);
pw.write ("aaaaa");
pw.write("bbbbbb");
pw.write("ccccc");
}catch(IOException e){
System.err.println(e.toString());}
}
}
--------------------------------
import java.io.*;
public class testfile {
public static void main(String[] args) {
try{
File outFile=new File("out.txt");
FileWriter out=new FileWriter(outFile);
BufferedWriter pw=new BufferedWriter(out);
pw.write ("aaaaa");
pw.write("bbbbbb");
pw.write("ccccc");
}catch(IOException e){
System.err.println(e.toString());}
}
}