Java Class and Objects
Java is an object-oriented programming (OOP) language. It allows you to divide complex problems into smaller sets by creating objects.
These objects share two characteristics:
- state
- behavior
Let's take few examples:
Laptop
is an object- It can be in
on
oroff
state. - You can
turn on
andturn off
lamp (behavior).
- It can be in
Bicycle
is an object- It has
current gear
,two wheels
,number of gear
etc. states. - It has
braking
,accelerating
,changing gears
etc. behavior.
- It has
Recommended reading: What is an object?