title: How do I initialize a Graphics object in Java?
body: <p>this is the code:</p>
  
  <pre><code>import java.awt.*;
  import java.applet.*;
  
  public class anim1 extends Applet{
  
      public void paint (Graphics g)
      {
          g.drawString("",400,300);
      }
  
      public static void main(String ad[])
      {
          anim1 a=new anim1();
          Graphics g1;
          a.paint(g1);
      }
  }
  </code></pre>
  
  <p>It says that g1 is not initialized. But how do I initialize an abstract class?</p>