• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How execution starts ?

 
Ranch Hand
Posts: 216
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was expecting Atleast one Reply.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe because the answer seems obvious: Android creates that object.
 
Nikhil Sagar
Ranch Hand
Posts: 216
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorr for the late reply.
But , thanks marshal...
reply
    Bookmark Topic Watch Topic
  • New Topic