Hi,I am trying to run the following program:
ackage com.mycompany.fileWrite;
import java.io.File;
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.IOException;
/**
*
* @author zulfi
*/
public class Main {
public static void main( String[] args ) {
try {
String data = " Tutorials Point is a best website in the world";
File f1 = new File("/home/zulfi/abc.txt");
if(!f1.exists()) {
f1.createNewFile();
}
FileWriter fileWritter = new FileWriter(f1.getName(),true);
BufferedWriter bw = new BufferedWriter(fileWritter);
bw.write(data);
bw.close();
System.out.println("Done");
} catch(IOException e){
e.printStackTrace();
}
}
}
But when I am checking the file there is no data in the file.
Somebody please guide me.
Zulfi.