I am need a little guidance here as to how I am to go about using a static method to read data from a text file. I know how to use a static method to write data to a text file, now I am wondering how to use a static method to read data from a text file. The following code is the code that read the data from the text file in the main method. Now that the code works in the main method, I am wondering how I can create a static method that does this. Thanks in advance to the person that has some ideas for me on this...
int index = 0;
double[] surfaceGravity = new double[10];
File gravity = new File("surfaceGravityData.txt");
Scanner inFile = new Scanner(gravity);
while (inFile.hasNextDouble())
{
surfaceGravity[index] = inFile.nextDouble();
index++;
}