I want to know how to output the integers of an array into a text file separated by different lines. This is the pertinent code below, but every time I run the program, the file is created but no data is saved into the file itself.
public static void printToFile(double[] gravity)throws IOException
{
PrintWriter outputFile = new PrintWriter (new FileWriter("gravitydata.txt", true));
for(int a = 0; a < 9; a++)
{
outputFile.println(gravity[a]);
}
}
outputFile.close();