title: Java error "Exception in thread "main" java.lang.NullPointerException"
body: <p>Error:"Exception in thread "main" java.lang.NullPointerException
      at com.vipgamming.Frytree.Game.main(Game.java:47)"</p>
  
  <p>I am not a very good programmer. Just saying and bad Inglish.</p>
  
  <p>Game.java:</p>
  
  <pre><code>package com.vipgamming.Frytree;
  
  import java.awt.Canvas;
  import java.awt.Dimension;
  
  import javax.swing.JFrame;
  
  public class Game extends Canvas implements Runnable {
  
  private static final long serialVersionUID = 1L;
  public static int width = 300;
  public static int height = width /16 * 9;
  public static int scale = 3;
  
  private Thread thread;
  private JFrame frame;
  private boolean running = false;
  
  public Game() {
      Dimension size = new Dimension(width * scale, height * scale);
      setPreferredSize(size);
  }
  
  public synchronized void start() {
      running = true;
      thread = new Thread(this, "Display");
      thread.start();
  }
  
  public synchronized void stop() {
      running = false;
      try {
          thread.join();
      }catch (InterruptedException e) {
          e.printStackTrace();
      }
  }
  
  public void run() {
      while (running) {
              System.out.println("FryTree...Loading...");
          }
      }
  
      public static void main(String [] args) {
          Game game = new Game();
          game.frame.setResizable(true);
          game.frame.setTitle("Frytree");
          game.frame.add(game);
          game.frame.pack();
          game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          game.frame.setLocationRelativeTo(null);
          game.frame.setVisible(true);
  
          game.start();
      }
  }
  </code></pre>
  
  <p>Sorry I didnt understand how to post code.(not Inglish.Portuguese)</p>