This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Ok what happens here is: 1) before the mobile constructor runs, the super class constructor is called and when it happens the instance variable are still in the uninitialized state. 2) U can see that during super class constructor call u have showDevice() method called. Now this showDevice() method will be called for the Mobile object. This is becuase as u know method is called based on the object, so here the object is Mobile, so its method is called. 3) Now since ur variable "device" is still not initialized, its considered to be null. Thats why ur output consists of null
After the super class constructor completes its running, the subclass constructor is run and thus the variable gets initialized.