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{ ... }
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{ ... }
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.