What is Class and Object in OOPs?

Class: Class is a blueprint from which objects are created.

Object: Object can be related to a real-world object. An object in Java is an instance of a class.

Object have states (properties/attributes) and behaviors (methods).

Instance variable – One copy per object.

Class variable – One copy per class.

There is a slight difference between Object and Instance:

  • Objects are things which resides in memory.
  • Instances are things that reference to them.

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.