212-15-4205_Forum answer

212-15-4205_Forum answer

by Faruk Ahmed -
Number of replies: 0

1. The differences between Class and Object are: 

i) Class is a blueprint or template from which objects are created.     Object is an instance of a class.

ii) Class is a group of similar objects.     Object is a real world entity such as pen, laptop, mobile etc.

iii) Class is a logical entity.     Object is a physical entity.

iv) Class is declared once.      Object is created many times as per requirement.

v) Class doesn't allocated memory when it is created.      Object allocates memory when it is created.

vi) Classes can’t be manipulated as they are not available in memory.      Objects can be manipulated.

vii) We can create class using “class” keyword.      We can create object using “new” keyword in Java. 


2. Car is an example of class as it has some instance variables and methods. It is the blueprint of other objects. So car is a class. However, its objects are Audi, Toyota, Nissan, Honda etc. as they are made by using the basic states of car class and they have the methods of car also.