偶在JBUILDER里写第一个JAVA程序中遇到的报错
程序如下:
import java.io.*;
public class Average {
public static void main ( String args[ ] ) throws IOException
{ int counter, garde, total, avergae;
total = 0;
counter = 1;
while ( counter <= 10 ){
System.out.print("Enter letter grade:");
System.out.flush();
System.in.read();
if ( grade == 'A' );
total = total + 4;
else if( grade == 'B' )
total = total + 3;
else if ( grade == 'C')
total = total +2;
else if ( grade == 'D' );
total = total + 1;
else if ( grade == 'F' );
total = total + 0;
System.in.skip(1);
counter = counter + 1;
}
avaerage = total / 10 ;
System.out.println( "class avergae is " + average );
}
}
在JB中老是显示我的else if 语句有问题
报错如下:
'else'without'if'at line 25
可是我的ELSE IF 语句是从书上抄的,应该不会有错误的呀!