-1

When ever I try to compile and run this code:

import java.awt.GridLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public abstract class screen implements ActionListener {
    private JFrame title = new JFrame("Tic-Tac-Toe");
    private JButton play = new JButton("");
    private JButton quit = new JButton("");

    public screen() {

        /* Create Window */
        title.setSize(300,300);
        title.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        title.setLayout(new GridLayout(3,3));

        /* Add Buttons To The Window */
        title.add(play);
        title.add(quit);

        /* Action Listeners */
        play.addActionListener(this);
        quit.addActionListener(this);

        /* Make The Window Visible */
        title.setVisible(true);

        /* Letters */
        play.setText("PLAY");
        quit.setText("QUIT");
    }
}

I get this:

Exception in thread "main" java.lang.NoSuchMethodError: main

I dont know what I did wrong.

I am a novice.

PLEASE HELP!!!

Lion
  • 17,515
  • 21
  • 76
  • 104

1 Answers1

0

You need to declare a public static void main(String args[]) {} method.

JoshDM
  • 4,838
  • 7
  • 42
  • 70
  • 4
    ::facepalm:: - I think you might want to start with a good beginner's book on Java rather than waving flags and hoping planes will land. – Brian Roach Feb 20 '13 at 00:08
  • You type it into your class. Knowledge of and use of such a method is one of the most basic of core Java skills, and as others have, I recommend you try to follow some online Java tutorials before continuing. Start here: http://docs.oracle.com/javase/tutorial/ – JoshDM Feb 20 '13 at 04:00