java.lang.NoSuchMethodError:线程"main"中的主要异常

rus*_*ell 1 java

我不明白为什么这个消息来--------->

java.lang.NoSuchMethodError: main
Exception in thread "main" .
Run Code Online (Sandbox Code Playgroud)

我知道它期待main()方法但是我正在构建一个不包含main方法的applet而是包含init()方法.所以我该怎么做?我的代码是s遵循--->

import java.applet.*;
import java.awt.*;

public class Ballbewegung1 extends Applet implements Runnable
{
// Initialisierung der Variablen

    int x_pos = 10;     // x - Position des Balles
    int y_pos = 100;    // y - Position des Balles
    int radius = 20;    // Radius des Balles

    public void init()
    {
        setBackground (Color.blue);
    }

    public void start ()
    {
        // Schaffen eines neuen Threads, in dem das Spiel l?uft
        Thread th = new Thread (this);
        // Starten des Threads
        th.start ();
    }

    public void stop()
    {

    }

    public void destroy()
    {

    }

    public void run ()
    {
        // Erniedrigen der ThreadPriority um zeichnen zu erleichtern
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);

        // Solange true ist l?uft der Thread weiter
        while (true)
        {
            // Ver?ndern der x- Koordinate
            x_pos ++;

            // Neuzeichnen des Applets
            repaint();

            try
            {
                // Stoppen des Threads f?r in Klammern angegebene Millisekunden
                Thread.sleep (20);
            }
            catch (InterruptedException ex)
            {
                // do nothing
            }

            // Zur?cksetzen der ThreadPriority auf Maximalwert
            Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
        }
    }

    public void paint (Graphics g)
    {
        g.setColor  (Color.red);
        g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
    }
}
Run Code Online (Sandbox Code Playgroud)

我不知道如何使用代码tag.so plz某人ans.

Mid*_*hat 5

applet需要一个容器来运行.将其嵌入html页面并使用appletviewer或Web浏览器运行它