I am writing an operation count to a file (denoted as "OpCount") for my program but I keep getting a strange symbol instead of an integer. I tried printing OpCount instead and it outputted the number I was looking for, so its just BufferedWriter doing something strange. Here is my code:
public void writeOpToFile() {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter("NumberOperations.txt"));
writer.write(OpCount);
writer.close();
} catch (IOException e) {
System.err.println("File was not found. Please make sure the file exists!");
}
}