java程序有俩种,一种是Application,一种是Applet。Application有入口函数Main(),而Applet是嵌入网页的小程序,它是支持JVM的浏览器下载到客户端运行的,不用Main函数。建议你看看<Think in java>,讲得很清楚。有关API到Sun的网站去看.http://java.sun.com/j2se/1.4.2/docs/api/
那在Applet嵌入小程序中有没有什么class一定要添加的呢??比如说是不是一定要添加init方法呢???我随便写了个程序,发现出现错误: //just testingimport javax.swing.JApplet; import javax.swing.JOptionPane;public class Square extends JApplet { public void init() { JOptionPane.showMessageDialog(null,"ok"); } }错误提示:Exception in thread "main" java.lang.NoSuchMethodError:main 好象说要添加main???
API最详细的就是到sun网站上下载个API文档。
但有些class是不能单独执行的,必须其它的class来调用
这种class就没有main方法(当然你也可以自己加上main方法)java api去
http://java.sun.com/api/index.html
//just testingimport javax.swing.JApplet;
import javax.swing.JOptionPane;public class Square extends JApplet
{
public void init()
{
JOptionPane.showMessageDialog(null,"ok");
}
}错误提示:Exception in thread "main" java.lang.NoSuchMethodError:main
好象说要添加main???