Class vs Object

  1. Class is a group of element having similar properties and behaviours , while Object is a  individual elements with seperate physical property and behaviour.
  2. Class is BluePrint of the Objects while Object is instance of Class.
  3. Class is a logical entity it contains logics where as object is physical entity it is representing  memory.
  4. Without class we are unable to create object.
  5. Based on single class (blue print) it is possible to create multiple objects but every object occupies memory.
  6. Using blue print of house we are able to create number of houses and each house required some area/space.
  7. For declaring the class we use class keyword and for creating object we need new keyword.
Ex:
Test t = new Test();

Object creation will start when jvm(java vertual machine) encounter "new" keyword. 
We can able to create object of Class in different ways. We will discuss object creation in detailed in  constructor .
Thank you guys.

No comments:

Post a Comment

Principles of Object Oriented Programming (OOP)

This article aims to explain the principles of Object-Oriented Programming in Java, using simple way to make it easier  to understand the fu...