Hi All,
Thanks to everyone who helped work out my probs last semester. Ended up with a B in Computer Science class. Even though I thought I was going to fail. Anyway, New semester another new problem. I have done the assignment and keep running it. I keep getting an error I'm not understanding. We're using JCreator slow, but its ok. Any suggestions or help, always GREATLY Appreciated.

* This class reads in exam scores from a text file, averages them, and writes the resulting average to a new text file.
import java.util.Scanner;
import java.io.*;
public class ScoreAverager
//default constructor
public ScoreAverager()
//method to read the file, average the grades, and print the new file
//an IO exception is thrown if the file can't be read or a new file cannot be written to
public void gradeAvg() throws IOException
Scanner input = new Scanner(System.in);
double sum = 0;
int count = 0;
double classAverage = 0;
String currentClass = null;
File inFile = new File("C:\\My Documents\\examscores.txt");
PrintWriter output = new PrintWriter(new File("C:\\Documents and Settings\\nwindAverages.txt"));
input = new Scanner(inFile);
currentClass = input.next();
int var1 = input.nextInt();
while(var1 != -9999)
sum += var1;
var1 = input.nextInt();
classAverage = sum/count;
output.println("Class : " + currentClass);
output.println("Class Average: " + classAverage);

catch (IOException e)
// input.close();


java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.

Ofcourse you will get this error. Your code compile without any problems and then you try to run it. It is only class with some methods but without "main" method and you will get this message everytime time you try to run it.
So either implement "main" method into this class or create another class with "main" method that will control execution of your first class.

This article has been dead for over six months. Start a new discussion instead.