<分区>
我什么都试过了。我正在使用 000webhost 来测试小程序。所以我上传了java文件
package game;
import java.applet.*;
import java.awt.*;
public class main extends Applet implements Runnable
{
int x_pos = 10;
int y_pos = 100;
int rad = 20;
public void init()
{
setBackground (Color.blue);
}
public void start()
{
Thread th = new Thread (this);
th.start();
}
public void stop()
{
}
public void destroy()
{
}
public void run()
{
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while(true)
{
x_pos ++;
repaint();
try
{
Thread.sleep(20);
}
catch(InterruptedException ex)
{
}
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.fillOval(x_pos - rad, y_pos - rad, 2*rad,2*rad);
}
到服务器。我检查了十六进制代码,前 4 位数字是 CAFEBABE。然后 Html 是
<head>
<h1 align = "center">Test</h1>
</head>
<body>
<applet code = "game.main" archive = "main.java" width = "40" height = "40">
</applet>
</body>
</html>
为什么我在类文件错误中得到不兼容的魔法值 1008813135?有什么想法吗?