+ 1
Describe about classes vs instances
Am no well known about classes instance constructor help me to get knowledge in that....
1 ответ
+ 9
A class is a blueprint which you use to create objects. An object is an instance of a class - it's a concrete 'thing' that you made using a specific class. So, 'object' and 'instance' are the same thing, but the word 'instance' indicates the relationship of an object to its class.
A class is basically a definition, and contains the object's code. An object is an instance of a class
for example if you say
String word = new String();
the class is the String class, which describes the object (instance) word.
When a class is declared, no memory is allocated so class is just a template.
When the object of the class is declared, memory is allocated.