import java.util.Random;
public class knife {
static Random randGen = new Random();
public static void main(String[] args) {
int kniferpd = 1;
int knifebullet = 0;
int charstrength = 10;
int charlightcc = 10;
int hit = randGen.nextInt(10) + 1 + charlightcc;
int crit = randGen.nextInt(100) + 1 + charlightcc;
int knifedmg = randGen.nextInt(5) + 6;
if (hit < 10)
System.out.println("You missed!");
else if (hit > 10 && crit > 98);
System.out.println("Critical strike of " + knifedmg * 2 + "dmg.");
else if (hit > 10 && crit < 98);
System.out.println("Strike of " + knifedmg + "dmg.");
{
}
}
}
当我编写此代码时,我收到以下错误,我不知道有什么问题!这是我的错误,它们出现在底部的“else if”上。
令牌“else”的语法错误,虽然是预期的