java write to file
import java.io.FileWriter; // Import the FileWriter class import java.io.IOException; // Import the IOException class to handle errors public class WriteToFile { public static void main(String[] args) { try { FileWriter fw = new FileWriter("C:/path/to/filename.txt"); fw.write("this is how u write a string"); fw.write(String.valueOf(108)); // cast number to string myWriter.close(); } catch (IOException e) { .. } } }