|
-
March 1st, 2000, 09:56 AM
#1
Java output to a file question
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());}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|