✏️ Explanatory Question

Difference between an object and a class?

👁 191 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

  • Class: A class is a blueprint or template that defines the properties (attributes) and behaviors (methods) of objects. It acts as an object factory. Example: class Car.
  • Object: An object is an instance of a class, representing a specific entity with defined properties and behaviors. Example: Car myCar = new Car();.