2

Class is defined as a collection of Objects in every OOPS Language, but I'm confused is a class an object by itself ?

If yes, Is class an Object in every OOPS language ?

Edit : By class I mean the structure defined as class NameOfClass{ ... }

Arun Joseph
  • 2,736
  • 25
  • 35

1 Answers1

1

In simple terms, think of a Class as a layout of a building and the Object as the building itself. With one layout you can build multiple buildings but each different from one and another. If you've a data member in your Class where you point to a different Class, they don't exist until you create a instance of your class.

So no Class it not an object by itself. But every Java object has an instance of the java.lang.Class describing it. Such instances are objects though.

Ashwanth Kumar
  • 667
  • 4
  • 10