I am using this code to write to a file in java. it has always worked and I am 100% sure its right. But still the file does not get written. I don't even get an error.
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class writetofile {
public static void main(String [] args){
FileWriter fw;
try {
fw = new FileWriter("testfile.txt");
BufferedWriter bw = new BufferedWriter(fw);
bw.write("this is test");
bw.write("this is test");
bw.write("this is test");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Could it be some other problem?