This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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: 44563
    
  34
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between class is loaded and class is instantiated
 
It's not a secret anymore!