I am attempting to make an interface with textfields where the data entered into the fields is stored in a variable, and then written to an external file. I am trying to use FileWriter fw = new FileWriter() to tranfer the variable to the file, but I cannot find an option available to send a variable, the only options when using fw.write() are strings and ints....
This is the block of code I am talking about:
try {
try (FileWriter fw = new FileWriter(f)) {
fw.write(""); // I need to put a variable in here??
}
} catch (Exception ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
}
Can someone please suggest how I can do this??