As we know Java is an object oriented language, therefore, we need to know how we can work with objects and find a solution using object oriented programming. For all this, understanding of class and object is important.
So, as we discussed earlier that to find a solution to any problem using object orientation, we need to look at the problem in a different way:
- we need to identify the object in a problem.
- determine the type of object
- determine what object has
what object does
For example, take Audi, BMW, Apple, Banana, Mercedes, Mango as an object.
These objects can be classified in the categories as:
To represent a type of object we need to define Class in JAVA.
The basic requirement to create an object is that a class must exist. In other words, an object in Java can never be created without a class.
A class is a Blueprint using which objects are created.