What is a class in Java? How is it different from an object?
Class:
A class is a blueprint or template for creating objects. It defines the properties (fields) and behaviors (methods) that the objects created from the class will have.
For example, a Car class might define fields like color, make, and model and methods like drive() and brake() .
Object:
An object is a specific instance of a class. It is a physical representation of the blueprint defined by the class and occupies memory.
For instance, an object of the Car class could be a specific car with color=”red”, make=”Toyota”, and model=”Corolla” .