Where is main() in Android?

In core Java programs we need a main() method, because while executing the byte code the JVM will search for the main() method in the class and start executing there.

In the case of Android, the Dalvik Virtual Machine (After android 5.0 DVM is replaced by Android Runtime) is designed to find a class which is a subclass of Activity and which is set as a LAUNCHER to start the execution of the application from its onCreate() method, so there is no need of a main() method.

For more information see the life cycle of Activity.

Leave a Comment