Java Applet runs without a main method?

前端 未结 4 2131
野性不改
野性不改 2020-12-11 04:51

I was running a Java class that extends Applet implements Runnable and apparently the program can run, but there is no main method. I thought Java

4条回答
  •  心在旅途
    2020-12-11 05:28

    Yes, but applets aren't applications. There is a main method in the applet runner (assuming it's implemented in Java; it need not be) but the applet doesn't work that way; it gets loaded/instantiated from a file and then it proceeds along its lifecycle through initialization, starting, operating, stopping, and finally being destroyed. The code that sends it through these states is hidden from the applet's view; it just knows its in an environment that can run applets.

提交回复
热议问题