View RSS Feed

Recent Blogs Posts

  1. Managing Initialization and Class Loading

    by , 11-29-2011 at 04:20 AM
    Java avoids many of the problems found with other languages related to the startup and initialization of objects in the right order, by taking a different approach to loading. The key to this is that everything in Java is an object. Each class exists in its own separate file. Therefore files are not loaded until the code is needed. The expression of this is that “class code is loaded at the point of first use.” This is usually when the first object of that class is constructed, but loading also ...
  2. Constructor calling ordering

    by , 11-13-2011 at 12:34 PM (My Java Tips)
    Constructors are used for initialization normally. Name of constructor should be same as that of the class. If no constructor is declared, a default constructor is created without parameters. Constructor does not return any thing.


    Consider the example below. ClassB inherits from ClassA. In the MainClass, we made an object of ClassB. Default constructor will be called. But the output suggests that first Constructor of ClassA is called and then the constructor of classB is called. ...