title: Compile Error: illegal start of expression
body: <p>I'm learning Java (The Gaming Side). I bought a book and it has some code in which I tried to copy and test it. The only problem is that it comes up with errors when I try to compile it.</p>
  
  <pre><code>C:\Users\James\Desktop\Java&gt;Javac GamePanel.java                                        
  GamePanel.java:57: illegal start of expression                              
          private void gameUpdate()                                   
          ^                         
  GamePanel.java:57: illegal start of expression                             
          private void gameUpdate()                               
                  ^                                              
  GamePanel.java:57: ';' expected                        
          private void gameUpdate()                                 
                                 ^                      
  GamePanel.java:64: reached end of file while parsing                                
  }→                   
   ^                                    
  4 errors              
  </code></pre>
  
  <p>The code is:</p>
  
  <pre><code>public class GamePanel extends  JPanel implements Runnable
  {
      private static final int PWIDTH = 500;
      private static final int PHEIGHT = 400;
  
      private Thread animator;
      private volatile boolean running = false;
  
      private volatile boolean gameOver = false;
  
      public GamePanel()
      {
          setBackground(Color.white);
          setPreferredSize( newDimension(PWIDTH, PHEIGHT));
      }
  
      public void addNotify()
      {
          super.addNotify();
          startGame();
      }
  
      public void startGame()
      {
          if (animator == null || !running)
          {
              animator = new Thread(this);
              animator.start();
          }
      }
  
      public void stopGame()
      {
          running = false;    
      }
  
      public void run()
      {
          running = true;
          while(running)
          {
              gameUpdate();
              gameRender();
              repaint();
  
              try
              {
                  Thread.sleep(20);
              }
          catch(InterruptedException ex)
          {
  
          }
          System.exit(0);
      }
  
      private void gameUpdate()
      {
      if (gameOver == false) {
  
      }
      }
  
  }
  </code></pre>
  
  <p>I know I'm probably doing something wrong but I checked it over and over again, can someone please enlighten me on what I am doing wrong?</p>