File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes java life cycle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

java life cycle

donald rieck
Ranch Hand

Joined: Mar 12, 2003
Posts: 75
oky doky
create a class:
(I'm purposly leaving out alot of the JLS stuff)
compile it: javac
JVM loads class
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

Joined: Aug 03, 2002
Posts: 7729
Please do not double post. Responses here please.
[ March 15, 2003: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: java life cycle
It's not a secret anymore!