• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between class is loaded and class is instantiated

 
prakash praksh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic