This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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: 37945
    
  22
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
 
Similar Threads
instance variable declarations, when do they occur?
Interesting mock question about arrays and postfix
static initializers v static blocks.
final instance variable
my notes on JLS for any1 who needs them !!