A class is a user-defined data type with a template that serves to define its properties.Once the class type has been defined, we can create “variables” of that type using declarations that are similar to the basic declarations. In Java, these variables are termed instances of classes.

A class is a collection of objects. Classes don’t consume any space in the memory. Once a class has been defined. A large number of objects can be created using the same class. Therefore, Class is considered the blueprint for the object.

Eg: Fruit is a class and its objects are mango, apple, etc.

The basic form of a class definition is:

class definition.

--

--