Its most known question Applet vs Application and common answer is applet starts from init() whereas application starts from main().
Life cycle of Applet : init() -> start() -> paint() -> stop() -> destroy()
but, what about, application ?? it starts from main() then destroy() ?? or it depends on coding part ?? Please correct me, if i’m wrong at any point.
Let say this is the simple java code
public class MyClass {
public static void main(String args[])
{
System.out.println("Hello World !!");
}
}
I found this, but i think, this is the common life cycle to all (applet, servlet, application).
The link you posted talks about the cycle of creating an application.
For a Java Application the lifecycle is only the
main()function. The application will end when all non-demon threads have terminated (threads are non-demon by default) or whenSystem.exit()is called.If you don’t start any threads, the only thread is the main thread, which will terminate at the end of the
main()function.