Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How execution starts ?

 
Nikhil Sagar
Ranch Hand
Posts: 216
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

 
Nikhil Sagar
Ranch Hand
Posts: 216
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was expecting Atleast one Reply.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe because the answer seems obvious: Android creates that object.
 
Nikhil Sagar
Ranch Hand
Posts: 216
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nikhil Sagar
Ranch Hand
Posts: 216
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorr for the late reply.
But , thanks marshal...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic