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:
Laptopis an object- It can be in
onoroffstate. - You can
turn onandturn offlamp (behavior).
- It can be in
Bicycleis an object- It has
current gear,two wheels,number of gearetc. states. - It has
braking,accelerating,changing gearsetc. behavior.
- It has
Recommended reading: What is an object?
