S
S
ShoNN2016-10-20 14:27:22
Java
ShoNN, 2016-10-20 14:27:22

Java program not starting (Error: Could not find or load main class)?

The simplest program from the book "Learning Java, 2nd edition" by K. Sierra does not start.
I do everything according to the instructions.
58c6f7a1335e4b4686a9805e8f8e95da.jpg

import java.awt.*;
import java.awt.event.*;
class Party {
  public void buildInvite() {
   Frame f = new Frame();
   Label l = new Label("Вечеринка у Децла дома");
   Button b = new Button("Ваша ставка");
   Button c = new Button("Сбросить");
   Panel p = new Panel();
   p.add(l);
  } //еще код
}

But the console throws an error.
18fb7809569045d89ce77c44d7d5fc29.jpg
Please tell me where to look for the error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-10-20
@zolt85

The entry point for running the program is the method

public static void main(String[] args) {
   //тут Ваш код
}

There is no such method in your class, so Java swears

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question