This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Also, for emphasis, please be aware that, while semi-colons immediately after a conditional are legal, it will result in behavior you may not expect - namely, the conditional will be considered 'empty' (ie - if there was a semi-colon immediately after the last else, grade would always be set to 'F'
–
Clockwork-MuseNov 2 '12 at 20:31

"elseif" has nothing to do with Java. There are people who try to adopt this notion in Java or C...but its just dangerous construct "else if" without any braces in between...that results in headaches to maintain code
–
user1697575Jan 16 '13 at 14:39

5 Answers
5

As others have already mentioned the syntax is else if - mind the space.

Moreover, I highly recommend you stick to conventional coding style until you become more confident in your skills.

A) For now, use brace syntax when using blocks and statements. Your code will be more readable and you will be able to identify your syntax errors easier. Though technically not required, you will be challenged trying to determine local variables and method scope without braces.

Remove the semi-colon after else if.
This kind of bug happens because of the empty statement, it will execute the semi-colon if the condition meets, then execute the other code (grade = 'B';) w/o any evaluation, this will separate the if of the else