编译通过了,运行不了,大家帮帮我看看什么问题,小程序
这个程序用于显示当前日期和时间,一秒更新依次
import java.awt.*;
import java.util.*;
public class Watch extends javax.swing.JApplet {
private Color butterscotch=new Color(255,204,102);
private String lasTime="";
public void init() {
setBackground(Color.black);
}
public void paint(Graphics screen){
Graphics2D screen2D=(Graphics2D)screen;
Font type=new Font("Monospaced",Font.BOLD,20);
screen2D.setFont(type);
GregorianCalendar day=new GregorianCalendar();
String time=day.getTime().toString();
screen2D.setColor(Color.black);
screen2D.drawString(lasTime,5,25);
try{
Thread.sleep(1000);
}catch(InterruptedException e){
//do nothing
}
lasTime=time;
repaint();
}
}
出现这样的错误
java.lang.NoSuchMethodError: main
Exception in thread "main"
是指什么,怎么办啊