title: "Cannot instantiate the Type Main"
body: <p>I keep getting this error every time I create a new object with the class name: </p>
  
  <p>"Cannot instantiate the Type Main"</p>
  
  <hr>
  
  <p>This is the code:</p>
  
  <pre><code>import javax.swing.*;
  import java.util.Scanner;
  import java.applet.Applet;
  import java.awt.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.event.KeyEvent;
  import java.awt.event.KeyListener;
  import java.awt.geom.Ellipse2D;
  
  public abstract class Main extends JPanel implements ActionListener, KeyListener{
  
  Timer t = new Timer(5, this);
  double x = 0, y = 0, velX = 0, velY = 0;
  
  public Main() {
      t.start();
      addKeyListener(this);
      setFocusable(true);
      setFocusTraversalKeysEnabled(false);
  
  }
  
  public void paintComponent(Graphics g) {
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;
      g2.fill(new Ellipse2D.Double(x, y, 40, 40));
      }
  
  public void actionPerformed(ActionEvent e) {
      repaint();
      x += velX;
      y += velY;
  
      }
  
  public void up() {
      velY = -1.5;
      velX = 0;
      }
  
  public void down() {
      velY = -1.5;
      velX = 0;
      }
  
  public void left() {
      velX = -1.5;
      velY = 0;
  
      }
  public void right() {
      velX = -1.5;
      velY = 0;
  
      }
  
  public void keyPressed(KeyEvent e) {
      int code = e.getKeyCode();
      if (code == KeyEvent.VK_UP) {
          up();
          }
      if (code == KeyEvent.VK_DOWN) {
          down();
      }
      if (code == KeyEvent.VK_LEFT) {
          left();
      }
      if (code == KeyEvent.VK_RIGHT) {
          right();
      }
  
      Main m = new Main();
      JFrame f = new JFrame();
      f.add(m);
      f.setVisible(true);;
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setSize(800,600);
  
  }
  public void keyTyped(KeyEvent e) {}
  public void keyReleased(KeyEvent e) {}
  
  }
  </code></pre>
  
  <p>And this is the object that keeps getting this "error":</p>
  
  <pre><code>Main m = new Main();
  </code></pre>
  
  <p>(I am very very new to making UI's, infact, this is my 3rd, so I have no idea why I cannot instantiate the Type)</p>