PrintWriter add text to file
问题 In my online computer science class I have to write a program to determine the surface gravity on each planet in the solar system. I have gotten almost every aspect of it to work save one. I need to write the surface gravity to a file using a separate method. This is my current method: public static void writeResultsToFile(double g) throws IOException{ PrintWriter outFile = new PrintWriter(new File("planetaryData.txt")); outFile.printf("%.2f%n", g); outFile.close(); } My problem is that when