Intuition on Class and Object in Java
In this class, We discuss Intuition on Class and Object in Java.
The reader can take a complete core Java course. Click Here.
The intuition we provide in this class will help the reader to understand the following classes.
First, we go with a real-life example.
We understand class and object along with real-life examples.
We need to manufacture a bike.
The first step is to create a blueprint, prototype, or design.
Once the design is over, we go to the manufacturing unit.
In the manufacturing unit, we allot
1) Time
2) Machine resources
3) Human resources.
We allocate the resources and manufacture a bike.
We allocate multiple times to manufacture multiple bikes.
For the first bike, we gave input as iron.
We got the output as a bike made of iron.
For the second bike, we gave input as steel.
We got the output as a bike made of steel.
As input changes, output changes, but the design is not changing.
Similar example in computer science.
The below diagram shows the Google pages.
We gave the input as a learning monkey.
The output is the websites related to learning monkey keywords.
The second input is made in India.
The output is the websites related to “Make in India.”
The logic we apply in the back end is the same for the above two inputs.
We write the logic in a class.
Class is a blueprint of an object.
One logic is written we need resources to execute.
Allocating resources is an object.
The object is an instance of a class.
In the above example, we allocate two objects.
The first object input is learning monkey.
The second object input is “Make in India”.