This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes difference between class is loaded and class is instantiated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference between class is loaded and class is instantiated" Watch "difference between class is loaded and class is instantiated" New topic
Author

difference between class is loaded and class is instantiated

prakash praksh
Greenhorn

Joined: Oct 22, 2009
Posts: 2
Please help me to understand the following:

If no initialization is provided for a static variable either in the declaration or in a static initializer block, it is initialized with the default value of its type when the class is loaded.

Similarly, if no initialization is provided for an instance variable either in the declaration or in an instance initializer block it is initialized with the default value of its type when the class is instantiated.


What is the difference between class is loaded and class is instantiated ?



Thanks,
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39100
    
  23
Welcome to JavaRanch

A class is loaded when it is required for the application. A class is instantiated whenever an object is created from it.
 
GeeCON Prague 2014
 
subject: difference between class is loaded and class is instantiated