execution starts from calling to onCreate method just like calling to main method in java but main method is static and onCreate method method is non-static so there should be a object of Test class in this case to call this method ?
So my problem is where is that object ?
Ulf Dittmer wrote:Maybe because the answer seems obvious: Android creates that object.
if it is that much obvious and having no problems then why not java Designers release a new version with the same concept where jvm can create object before calling to the main method.
and if it is that much obvious than why create a object (and waste memory although in case of mobile device memory is limited too) if you have a concept to make onCreate method static .
and I think you meant DVM in place of Android ?
Joined: Mar 22, 2005
Differentiating between Android and the DVM seems like splitting hairs - Android is nothing without the DVM.
But you're mixing Java and Android, which are two different kinds of VMs. The JVM is established - why would anyone go to the trouble of releasing a new version that did allocate an object of the class that contains the main method if ALL desktop Java apps out there assume that that is not happening? Lots of apps might break if that were to happen. In fact, many Java desktop apps allocate an instance of that class in the main method.
Furthermore, allocating that object on Android is not a waste of memory, as the object is used by the application.