Posts

Showing posts from April, 2009

Java Constructor Loading Tips

This is very interesting topic to discuses Java constructor loading. As a Java programmer, unfortunately, I haven't had a chance to go through in my experience because most of the time standard programming doesn't use this. However, it is very important to know that how the JVM load static/instance blocks and variables with the constructor in the initiation of new objects. I've wrote very simple program to illustrate this scenario. public class Constructors { public static int count=0; public static void main(String[] args){ System.out.println("["+ ++Constructors.count +"]"+"Instantiate"); ChildClass c = new ChildClass(); } } //super class class SuperClass { //super class instance variable int varS =++Constructors.count; SuperClass(){ System.out.println("["+ ++Constructors.count +"]"+...