Forgive me for my lack of Java-lingo. In fact I'd like to find a book someday that will teach me all of the definitions of words that are mentioned for Java classes and objects, as well as processes, etc.
If the title isn't at all clear, what I mean is "what happens first when an object is created?"
Is the order Static, Transient then Constructor?
For example, consider the following code--
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package chapter_21_multimedia_practice;
public class NewClass {
/*Assumption:
Much more performance-friendly to have static calls before any pre-initialization.*/
static { System.out.println("Running..."); /*what if I did deserializaton here?*/}
/*Field variables here...*/
public static void main(String args[]){
System.out.println("I think I got it to work!");
}
}
--from the example, you can probably tell that I was fooling around with NetBeans and somehow opened a file that had an anonymous static block so I tested it out and realized that it worked. I never saw something like it before so I was curious.
From there I tried creating an object of this class and realized that before the constructor was called, the static block ran. Also the compiler had an easier time compiling when the static call was closer to the head of the class, which is why I made the above assumption.
My question now is... what is the order of processes executed during the instantiation of a new object?