Why do applets not need a main()?

前端 未结 5 2156
长发绾君心
长发绾君心 2020-12-03 22:08

This applies to subclasses of Applet, Servlet, Midlet, etc.

Why do they not need a main()? If I wanted to create a Craplet class that start

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 22:11

    The executing environment of an applet (typically, your web browser) calls the applet methods at different points depending on what stage of rendering the it's reached. That provides a level of abstraction that's better suited for the web than a simple main() method. Further, launching arbitrary Java programs with main() methods would usually be considered something of a security risk.

提交回复
热议问题