user10802934
user10802934

Reputation:

"error: reached end of file while parsing"

So my AP Comp Sci lab asked me to build and erase, here's my erase code, and I've come up with the error,

error: reached end of file while parsing

Would love some help with it, thanks. Obviously, there's a lot more code, if it helps, I can add it no problem.

   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);
     }
   }

Upvotes: 0

Views: 536

Answers (1)

Stephanie
Stephanie

Reputation: 26

I get this error message when I'm missing a bracket somewhere, but it looks like those are all accounted for here. I would check the rest of the file and make sure that you aren't missing a bracket anywhere else.

Upvotes: 1

Related Questions