// Write x to file
public void writeFile(String x, String file){
try{
// Create file
FileWriter fstream = new FileWriter(file);
// Create Writer
BufferedWriter out = new BufferedWriter(fstream);
// Write x to the file
out.write(x);
//Close the output stream
out.close();
}catch (Exception e){
//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
No comments:
Post a Comment