所以我的AP Comp Sci实验室要求我进行构建和擦除,这是我的擦除代码,并且我想出了错误,
错误:解析时到达文件末尾
很乐意提供一些帮助,谢谢。 显然,还有很多代码,如果有帮助,我可以毫无问题地添加它。
public void erase(Graphics g, int f)
{
frame = f;
if (frame == 1)
{
//First
g.drawRect(50,50,100,100);
g.drawLine(70,70,70,100);
g.drawLine(120,70,120,100);
g.drawLine(70,125,100,125);
}
if (frame == 2)
{
//Second - Left Eye Gone
g.drawRect(150,50,100,100);
g.drawLine(220,70,220,100);
g.drawLine(170,125,200,125);
}
if (frame = 3)
{
//Third - Right Eye Gone
g.drawRect(250,50,100,100);
g.drawLine(270,70,270,100);
g.drawLine(270,125,300,125);
}
if (frame == 4)
{
//Fourth - Mouth Gone
g.drawRect(350,50,100,100);
g.drawLine(370,70,370,100);
g.drawLine(420,70,420,100);
}
if (frame == 5)
{
//Fifth - Mouth and Left Eye
g.drawRect(450,50,100,100);
g.drawLine(520,70,520,100);
}
if (frame == 6)
{
//Sixth - Mouth and Right Eye
g.drawRect(550,50,100,100);
g.drawLine(570,70,570,100);
}
}
答案 0 :(得分:1)
我在某处缺少括号时收到此错误消息,但看起来这些都在这里说明了。我会检查文件的其余部分,并确保您在其他任何地方都不会缺少括号。