Describe about classes vs instances | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Describe about classes vs instances

Am no well known about classes instance constructor help me to get knowledge in that....

16th Dec 2017, 9:14 AM
Venkatesh R B
Venkatesh R B - avatar
1 Answer
+ 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.
16th Dec 2017, 9:41 AM
GAWEN STEASY
GAWEN STEASY - avatar