程序不会编译:"非法启动类型"

时间:2016-07-04 20:25:42

标签: java

我写了这个程序,我不断得到:

  

" Grades.java:10:错误:非法启动类型"

import java.util.Scanner;
public class Grades
{
    final int StudentGrades = 3;

    int total;
    double average;
    int[] GradesArray = new int[StudentGrades];
     Scanner keyboard = new Scanner(System.in);
    for (int i = 0; i < GradesArray.length; i++)
    {
        System.out.print("Enter grades for Student" + (i+1));
        GradesArray[i] = keyboard.nextInt();
        total += GradesArray[i];
    }

        average = total/StudentGrades;

        if(average >= 90 && average <= 100)
          System.out.print("you Got a A");
        else if(average >= 80 && average <= 89)
         System.out.print("you Got a B");
        else if (average >= 70 && average <= 79)
         System.out.print("you Got a C");
        else if (average >= 60 && average <= 69)
          System.out.print("you Got a D");
          else
            System.out.print("you Got a F");

          for(int i = 0; i < GradesArray.length; i++)
        {
            System.out.println("Grades for exam #" + (it1)+"are as follows " + GradesArray[i]);

        }

}

1 个答案:

答案 0 :(得分:1)

您需要一个包含for循环向下的所有内容的启动方法。

一般:

public static void main (String [] args) {

}