Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

java life cycle

 
donald rieck
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Report post to moderator
oky doky
create a class: app.java
(I'm purposly leaving out alot of the JLS stuff)
compile it: javac app.java
JVM loads class app.java.
Static members are initialized.(vars,blocks,methods)
JVM goes to the main method.
Object is declared in main: App myApp;
Object creation statement: myApp = new App();
New is envoked.
New operator allocates memory.
New calls the constructor.
Constructor body is not yet executed though.
New operator calls the super constructor.
Super instance variables are initialized to their defaults.
New operaator calls the original ctor.
Its instance variables are initialized to their defaults.
Constructor body is now executed.
Is this a good "loose" interpretation?
I'm trying to get a simpler idea on order of events for now.
Please help.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not double post. Responses here please.
[ March 15, 2003: Message edited by: Barry Gaunt ]
 
    Bookmark Topic Watch Topic
  • New Topic