This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Create a class. Class is loaded by the JVM. Class members are declared and initialized by the JVM. Object is declared(instantained?) by the new. Memory is allowcated by the new?(not the ctor) Proper constructor is invoked by the new. constructor then initializes object level variables? is this how it goes? I need help on this: info , books.... [ March 12, 2003: Message edited by: donald rieck ] [ March 12, 2003: Message edited by: donald rieck ]
Hi Donald, To some extent, you are right. create a class. Ok class is loaded by the JVM. Ok class variables are declared and initialized-then. Ok new is implemented - then. Unlike C++ or C, In Java, we never implement the new method. We only write the ctor (overloaded, if required.) object is declared(instantained?) by the new. memory is allowcated by the new. After the memory allocation, the object level variables are automatically initialized to their defaults. ex : if we have private int iPrivateObjectLevelVariable, then this variable by default gets the value 0 constructor is called by the new. object is initialized by the constructor. This does not happen. After the previous step, move directly to the next step. instance variables are initialized by the c-tor. Ok is this how it goes? I need help on this: info , books.... I dont know of any book that might contain all this information, however, using SOP's (System.out.println) you may get some answers. Hope this helps. 'amit
Joined: Mar 12, 2003
what place in the sequience are static members handled? Before any objects are created and the JVM loads the class?
Joined: Mar 12, 2003
static member as you know are class level variables. Thus they are initialized when the class is first loaded in the JVM. However, you may use static initialization block , in case you need to initialize these variable differently. Core Java Part - I, a book by Sun's Press, details this. 'amit
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com